Parcourir la source

Evolution #687: Tags: bouton enlever tous

Bastien Sevajol il y a 11 ans
Parent
révision
1c0aa54267

+ 2 - 0
app/Resources/translations/userui.en.yml Voir le fichier

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

+ 2 - 0
app/Resources/translations/userui.fr.yml Voir le fichier

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

+ 2 - 2
src/Muzich/CoreBundle/Controller/CoreController.php Voir le fichier

@@ -438,10 +438,10 @@ class CoreController extends Controller
438 438
    * 
439 439
    * @return Response 
440 440
    */
441
-  public function getDefaultTagsAction()
441
+  public function getDefaultTagsAction($favorites = false)
442 442
   {    
443 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 446
       $es = $this->getElementSearcher(null, true);
447 447
       return $this->jsonResponse(array(

+ 2 - 2
src/Muzich/CoreBundle/Resources/config/routing.yml Voir le fichier

@@ -49,8 +49,8 @@ filter_mytags:
49 49
   defaults: { _controller: MuzichCoreBundle:Core:filterMytags }
50 50
 
51 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 55
 ajax_add_tag:
56 56
   pattern: /ajax/add-tag

+ 3 - 2
src/Muzich/CoreBundle/Resources/public/css/main.css Voir le fichier

@@ -1996,12 +1996,13 @@ div#tourControls a#tourEnd
1996 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 2002
   margin-bottom: 0;
2003 2003
   margin-left: 0px;
2004 2004
   margin-top: 5px;
2005
+  margin-right: 11px;
2005 2006
 }
2006 2007
 
2007 2008
 form#address_update input.intext

+ 35 - 0
src/Muzich/CoreBundle/Resources/public/js/muzich.js Voir le fichier

@@ -2981,6 +2981,41 @@ $(document).ready(function(){
2981 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 3021
 function open_ajax_popin(url, callback)

+ 2 - 1
src/Muzich/CoreBundle/Resources/views/SearchElement/form.html.twig Voir le fichier

@@ -35,7 +35,8 @@
35 35
   </div>
36 36
   
37 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 42
   <div>

+ 18 - 2
src/Muzich/CoreBundle/Resources/views/Tag/tagsPrompt.html.twig Voir le fichier

@@ -1,12 +1,28 @@
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 7
   <img alt="help ?" src="{{ asset('img/1362157855_help.png') }}" />
4 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 22
 <div class="tags_prompt" id="tags_prompt_{{ form_name }}">
7 23
    
8
-  
9 24
   <ul class="tagbox"></ul>
25
+  <div style="clear: both;"></div>
10 26
   
11 27
   <input
12 28
     class="tag_prompt niceinput"