Browse Source

Evolution #687: Tags: bouton enlever tous

Bastien Sevajol 12 years ago
parent
commit
1c0aa54267

+ 2 - 0
app/Resources/translations/userui.en.yml View File

94
     help:  |
94
     help:  |
95
             Choissiez un tag dans la liste ci-dessous en cliquant dessus. Pour saisir plusieurs tags
95
             Choissiez un tag dans la liste ci-dessous en cliquant dessus. Pour saisir plusieurs tags
96
             renouvellez l'opération pour chacuns d'entre eux.
96
             renouvellez l'opération pour chacuns d'entre eux.
97
+    remove_all: Enlever tous les tags
98
+    favorites:  Mettre mes tags favoris
97
   help:  |
99
   help:  |
98
            Saisissez <strong>une liste de tags</strong> ci-dessous: Entrez 
100
            Saisissez <strong>une liste de tags</strong> ci-dessous: Entrez 
99
            <strong>un tag a la fois</strong> et choisissez les a l'aide de 
101
            <strong>un tag a la fois</strong> et choisissez les a l'aide de 

+ 2 - 0
app/Resources/translations/userui.fr.yml View File

99
     help:  |
99
     help:  |
100
             Choissiez un tag dans la liste ci-dessous en cliquant dessus. Pour saisir plusieurs tags
100
             Choissiez un tag dans la liste ci-dessous en cliquant dessus. Pour saisir plusieurs tags
101
             renouvellez l'opération pour chacun d'entre eux.
101
             renouvellez l'opération pour chacun d'entre eux.
102
+    remove_all: Enlever tous les tags
103
+    favorites:  Mettre mes tags favoris
102
   help:  |
104
   help:  |
103
            Saisissez <strong>une liste de tags</strong> ci-dessous: Entrez 
105
            Saisissez <strong>une liste de tags</strong> ci-dessous: Entrez 
104
            <strong>un tag à la fois</strong> et choisissez les à l'aide de 
106
            <strong>un tag à la fois</strong> et choisissez les à l'aide de 

+ 2 - 2
src/Muzich/CoreBundle/Controller/CoreController.php View File

438
    * 
438
    * 
439
    * @return Response 
439
    * @return Response 
440
    */
440
    */
441
-  public function getDefaultTagsAction()
441
+  public function getDefaultTagsAction($favorites = false)
442
   {    
442
   {    
443
     $last_tags = $this->get("session")->get('user.element_search.last_tags');
443
     $last_tags = $this->get("session")->get('user.element_search.last_tags');
444
-    if (!count($last_tags))
444
+    if (!count($last_tags) || $favorites)
445
     {
445
     {
446
       $es = $this->getElementSearcher(null, true);
446
       $es = $this->getElementSearcher(null, true);
447
       return $this->jsonResponse(array(
447
       return $this->jsonResponse(array(

+ 2 - 2
src/Muzich/CoreBundle/Resources/config/routing.yml View File

49
   defaults: { _controller: MuzichCoreBundle:Core:filterMytags }
49
   defaults: { _controller: MuzichCoreBundle:Core:filterMytags }
50
 
50
 
51
 ajax_get_favorites_tags:
51
 ajax_get_favorites_tags:
52
-  pattern: /ajax/my-favorites-tags
53
-  defaults: { _controller: MuzichCoreBundle:Core:getDefaultTags }
52
+  pattern: /ajax/my-favorites-tags/{favorites}
53
+  defaults: { _controller: MuzichCoreBundle:Core:getDefaultTags, favorites: false }
54
 
54
 
55
 ajax_add_tag:
55
 ajax_add_tag:
56
   pattern: /ajax/add-tag
56
   pattern: /ajax/add-tag

+ 3 - 2
src/Muzich/CoreBundle/Resources/public/css/main.css View File

1996
   float: right;
1996
   float: right;
1997
 }
1997
 }
1998
 
1998
 
1999
-a.tags_prompt_helpbox
1999
+a.tag_prompt_tool
2000
 {
2000
 {
2001
-  float: left;
2001
+  float: right;
2002
   margin-bottom: 0;
2002
   margin-bottom: 0;
2003
   margin-left: 0px;
2003
   margin-left: 0px;
2004
   margin-top: 5px;
2004
   margin-top: 5px;
2005
+  margin-right: 11px;
2005
 }
2006
 }
2006
 
2007
 
2007
 form#address_update input.intext
2008
 form#address_update input.intext

+ 35 - 0
src/Muzich/CoreBundle/Resources/public/js/muzich.js View File

2981
      open_ajax_popin(url_email_not_confirmed, function(){});
2981
      open_ajax_popin(url_email_not_confirmed, function(){});
2982
    });
2982
    });
2983
    
2983
    
2984
+   /*
2985
+    * Tag prompte tools
2986
+    */
2987
+   
2988
+   $('a.tags_prompt_remove_all').click(function(){
2989
+     window.search_tag_prompt_connector.initializeTags([]);
2990
+   });
2991
+   
2992
+   $('a.tags_prompt_favorites').click(function(){
2993
+     
2994
+    $('img#tag_prompt_loader_search').show();
2995
+    
2996
+    $.getJSON($(this).attr('href'), function(response) {
2997
+      
2998
+      $('img#tag_prompt_loader_search').hide();
2999
+      window.ResponseController.execute(
3000
+        response,
3001
+        function(){},
3002
+        function(){}
3003
+      );
3004
+      
3005
+      var tags = [];
3006
+      for (i in response.tags)
3007
+      {
3008
+        var tag = new Tag(i, response.tags[i]);
3009
+        tags.push(tag);
3010
+      }
3011
+      
3012
+      window.search_tag_prompt_connector.initializeTags(tags);
3013
+      
3014
+    });
3015
+    
3016
+    return false;
3017
+   });
3018
+   
2984
 });
3019
 });
2985
 
3020
 
2986
 function open_ajax_popin(url, callback)
3021
 function open_ajax_popin(url, callback)

+ 2 - 1
src/Muzich/CoreBundle/Resources/views/SearchElement/form.html.twig View File

35
   </div>
35
   </div>
36
   
36
   
37
   {% include "MuzichCoreBundle:Tag:tagsPrompt.html.twig" with { 
37
   {% include "MuzichCoreBundle:Tag:tagsPrompt.html.twig" with { 
38
-    'form_name'     : form_name
38
+    'form_name'     : form_name,
39
+    'display_tools' : true
39
   } %}
40
   } %}
40
   
41
   
41
   <div>
42
   <div>

+ 18 - 2
src/Muzich/CoreBundle/Resources/views/Tag/tagsPrompt.html.twig View File

1
+{% if display_tools is not defined %}
2
+  {% set display_tools = false %}
3
+{% endif %}
1
 
4
 
2
-<a title="{{ 'tags.prompt.help_box_title'|trans({}, 'userui') }}" href="{{ path('helpbox_bootstrap', {'ressource_id':'tags_prompt'}) }}" class="helpbox tags_prompt_helpbox">
5
+
6
+<a title="{{ 'tags.prompt.help_box_title'|trans({}, 'userui') }}" href="{{ path('helpbox_bootstrap', {'ressource_id':'tags_prompt'}) }}" class="helpbox tag_prompt_tool tags_prompt_helpbox">
3
   <img alt="help ?" src="{{ asset('img/1362157855_help.png') }}" />
7
   <img alt="help ?" src="{{ asset('img/1362157855_help.png') }}" />
4
 </a>
8
 </a>
5
 
9
 
10
+{% if display_tools %}
11
+
12
+  <a title="{{ 'tags.prompt.remove_all'|trans({}, 'userui') }}" href="#" class="tag_prompt_tool tags_prompt_remove_all">
13
+    <img alt="remove_all" src="{{ asset('img/icon_close_red.png') }}" />
14
+  </a>
15
+
16
+  <a title="{{ 'tags.prompt.favorites'|trans({}, 'userui') }}" href="{{ path('ajax_get_favorites_tags', {'favorites' : true}) }}" class="tag_prompt_tool tags_prompt_favorites">
17
+    <img alt="favorites" src="{{ asset('img/icon_heart.png') }}" />
18
+  </a>
19
+
20
+{% endif %}
21
+
6
 <div class="tags_prompt" id="tags_prompt_{{ form_name }}">
22
 <div class="tags_prompt" id="tags_prompt_{{ form_name }}">
7
    
23
    
8
-  
9
   <ul class="tagbox"></ul>
24
   <ul class="tagbox"></ul>
25
+  <div style="clear: both;"></div>
10
   
26
   
11
   <input
27
   <input
12
     class="tag_prompt niceinput"
28
     class="tag_prompt niceinput"