浏览代码

Ajout de deux bouton: aucun tags, mes tags

bastien 13 年前
父节点
当前提交
85c0807aaf

+ 2 - 0
app/Resources/translations/userui.fr.yml 查看文件

33
 filter:
33
 filter:
34
   network: "Résultats de "
34
   network: "Résultats de "
35
   submit:  Filtrer
35
   submit:  Filtrer
36
+  clear:   Aucun filtre
37
+  mytags:  Tous mes tags
36
   
38
   
37
 element_add:
39
 element_add:
38
   url:
40
   url:

+ 14 - 0
src/Muzich/CoreBundle/Controller/CoreController.php 查看文件

263
     
263
     
264
   }
264
   }
265
   
265
   
266
+  public function filterClearAction()
267
+  {
268
+    $es = $this->getElementSearcher();
269
+    $es->update(array('tags' => array()));
270
+    $this->setElementSearcherParams($es->getParams());
271
+    return $this->redirect($this->container->get('request')->headers->get('referer'));
272
+  }
273
+  
274
+  public function filterMytagsAction()
275
+  {
276
+    $this->getElementSearcher(null, true);
277
+    return $this->redirect($this->container->get('request')->headers->get('referer'));
278
+  }
279
+  
266
 }
280
 }

+ 8 - 0
src/Muzich/CoreBundle/Resources/config/routing.yml 查看文件

20
   pattern: /search/tagid/{string_search}
20
   pattern: /search/tagid/{string_search}
21
   defaults: { _controller: MuzichCoreBundle:Search:searchTagId, string_search: null }
21
   defaults: { _controller: MuzichCoreBundle:Search:searchTagId, string_search: null }
22
 
22
 
23
+filter_clear:
24
+  pattern: /filter/clear
25
+  defaults: { _controller: MuzichCoreBundle:Core:filterClear }
26
+
27
+filter_mytags:
28
+  pattern: /filter/my-tags
29
+  defaults: { _controller: MuzichCoreBundle:Core:filterMytags }
30
+
23
 ####
31
 ####
24
 
32
 
25
 info_about:
33
 info_about:

+ 1 - 1
src/Muzich/CoreBundle/Resources/views/SearchElement/form.html.twig 查看文件

6
     {{ form_label(search_form.network, 'filter.network'|trans({}, 'userui')) }}
6
     {{ form_label(search_form.network, 'filter.network'|trans({}, 'userui')) }}
7
     {{ form_widget(search_form.network) }}
7
     {{ form_widget(search_form.network) }}
8
   </div>
8
   </div>
9
-
9
+  
10
   {% include "MuzichCoreBundle:Tag:tagsPrompt.html.twig" with { 'form_name': form_name } %}
10
   {% include "MuzichCoreBundle:Tag:tagsPrompt.html.twig" with { 'form_name': form_name } %}
11
   
11
   
12
   {{ form_row(search_form.tags) }}
12
   {{ form_row(search_form.tags) }}

+ 11 - 0
src/Muzich/CoreBundle/Resources/views/Tag/tagsPrompt.html.twig 查看文件

2
 
2
 
3
 <div class="tags_prompt" id="tags_prompt_{{ form_name }}">
3
 <div class="tags_prompt" id="tags_prompt_{{ form_name }}">
4
   <span class="help">{{ 'tags.help'|trans({}, 'userui') }}</span>
4
   <span class="help">{{ 'tags.help'|trans({}, 'userui') }}</span>
5
+  
6
+  {% if display_specials_buttons is defined %}
7
+    {% if display_specials_buttons == true %}
8
+      <br />
9
+      <input class="clear" type="button" value="{{ 'filter.clear'|trans({}, 'userui') }}" />
10
+      <input type="hidden" class="filter_clear_url" value="{{ path('filter_clear') }}" />
11
+      <input class="mytags" type="button" value="{{ 'filter.mytags'|trans({}, 'userui') }}" />
12
+      <input type="hidden" class="filter_mytags_url" value="{{ path('filter_mytags') }}" />
13
+    {% endif %}
14
+  {% endif %}
15
+  
5
    <input class="tags_prompt_list" id="tags_prompt_list_{{ form_name }}" name="tags" value=""> 
16
    <input class="tags_prompt_list" id="tags_prompt_list_{{ form_name }}" name="tags" value=""> 
6
 </div>
17
 </div>
7
 
18
 

+ 2 - 2
src/Muzich/CoreBundle/lib/Controller.php 查看文件

43
    * 
43
    * 
44
    * @return  ElementSearcher
44
    * @return  ElementSearcher
45
    */
45
    */
46
-  protected function getElementSearcher($count = null)
46
+  protected function getElementSearcher($count = null, $force_new = false)
47
   {
47
   {
48
     $session = $this->get("session");
48
     $session = $this->get("session");
49
     // Si l'objet n'existe pas encore, a t-on déjà des paramètres de recherche
49
     // Si l'objet n'existe pas encore, a t-on déjà des paramètres de recherche
50
-    if (!$session->has('user.element_search.params'))
50
+    if (!$session->has('user.element_search.params') || $force_new)
51
     {
51
     {
52
       // Il nous faut instancier notre premier objet recherche
52
       // Il nous faut instancier notre premier objet recherche
53
       // Premièrement on récupère les tags favoris de l'utilisateur
53
       // Premièrement on récupère les tags favoris de l'utilisateur

+ 5 - 6
src/Muzich/HomeBundle/Resources/views/Home/index.html.twig 查看文件

28
   <form action="{{ path('search_elements') }}" method="post" {{ form_enctype(search_form) }}>
28
   <form action="{{ path('search_elements') }}" method="post" {{ form_enctype(search_form) }}>
29
 
29
 
30
     {% include "MuzichCoreBundle:SearchElement:form.html.twig" with { 
30
     {% include "MuzichCoreBundle:SearchElement:form.html.twig" with { 
31
-      'form_name'      : search_form_name,
32
-      'search_tags'    : search_tags_id
31
+      'form_name'               : search_form_name,
32
+      'search_tags'             : search_tags_id,
33
+      'display_specials_buttons': true
33
     } %}
34
     } %}
34
-
35
-    <span class="help">{{ 'tags_filter.help'|trans({}, 'userui') }}</span>
36
-    <br />
37
-    <input type="submit" value="{{ 'filter.submit'|trans({}, 'userui') }}"/>
35
+    
36
+    <input class="main" type="submit" value="{{ 'filter.submit'|trans({}, 'userui') }}"/>
38
   </form>
37
   </form>
39
 
38
 
40
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
39
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}

+ 10 - 0
web/bundles/muzichcore/css/main.css 查看文件

436
   
436
   
437
   font-size: 85%;
437
   font-size: 85%;
438
   text-align: center;
438
   text-align: center;
439
+}
440
+
441
+input.main
442
+{
443
+  font-weight: bold;
444
+}
445
+
446
+input.clear, input.mytags
447
+{
448
+  font-size: 80%;
439
 }
449
 }

+ 27 - 16
web/bundles/muzichcore/js/muzich.js 查看文件

115
 
115
 
116
 $(document).ready(function(){
116
 $(document).ready(function(){
117
   
117
   
118
- // Affichage un/des embed
119
- $('a.element_embed_open_link').click(function(){
120
-   $(this).parent('li.element').find('a.element_embed_open_link').hide();
121
-   $(this).parent('li.element').find('a.element_embed_close_link').show();
122
-   $(this).parent('li.element').find('div.element_embed').show();
123
-   return false;
118
+   // Affichage un/des embed
119
+   $('a.element_embed_open_link').click(function(){
120
+     $(this).parent('li.element').find('a.element_embed_open_link').hide();
121
+     $(this).parent('li.element').find('a.element_embed_close_link').show();
122
+     $(this).parent('li.element').find('div.element_embed').show();
123
+     return false;
124
+   });
125
+
126
+   // Fermeture du embed si demandé
127
+   $('a.element_embed_close_link').click(function(){
128
+     $(this).parent('li.element').find('a.element_embed_open_link').show();
129
+     $(this).parent('li.element').find('a.element_embed_close_link').hide();
130
+     $(this).parent('li.element').find('div.element_embed').hide();
131
+     return false;
132
+   });
133
+   
134
+   // Bouton de personalisation du filtre
135
+   // pour le moment ce ne sotn que des redirection vers des actions
136
+   $('.tags_prompt input.clear').click(function(){
137
+     $(location).attr('href', $('input.filter_clear_url').val());
138
+   });
139
+   $('.tags_prompt input.mytags').click(function(){
140
+     $(location).attr('href', $('input.filter_mytags_url').val());
141
+   });
142
+   
124
  });
143
  });
125
-
126
- // Fermeture du embed si demandé
127
- $('a.element_embed_close_link').click(function(){
128
-   $(this).parent('li.element').find('a.element_embed_open_link').show();
129
-   $(this).parent('li.element').find('a.element_embed_close_link').hide();
130
-   $(this).parent('li.element').find('div.element_embed').hide();
131
-   return false;
132
- });
133
-
134
- });
144
+ 
145
+ 

+ 6 - 0
web/js/tags/jquery.tagBox.js 查看文件

172
               }
172
               }
173
               $('input#'+form_name+'_tags').val(array2json(input_values));
173
               $('input#'+form_name+'_tags').val(array2json(input_values));
174
             }
174
             }
175
+            
176
+            // Suppression tu tableau js
177
+            if (inArray(tagsAddeds[form_name], id))
178
+            {
179
+              delete tagsAddeds[form_name][id];
180
+            }
175
         },
181
         },
176
         updateInput : function() {
182
         updateInput : function() {
177
             
183