Browse Source

Evolution #375: Pages avec nuage de tags

Bastien Sevajol 12 years ago
parent
commit
2fcc5abc48

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

@@ -64,6 +64,10 @@ tags:
64 64
     has_news_link:  cliquez ici pour les afficher
65 65
     has_news_link_one:  cliquez ici pour l'afficher
66 66
     has_news_link_more_x:  cliquez ici pour en afficher %x%
67
+  cloud:
68
+    display_more:           Des tags ont été cachés, cliquez ici pour les afficher tous
69
+    filter:
70
+      text:                 Chercher un tag parmis la liste
67 71
            
68 72
 filter:
69 73
   network: "Résultats de "

+ 13 - 1
src/Muzich/CoreBundle/Resources/views/Tag/tagsList.favorite.html.twig View File

@@ -1,16 +1,28 @@
1 1
 {% if tags|length %}
2
+
3
+  <label for="cloud_tags_filter" >{{ 'tags.cloud.filter.text'|trans({}, 'userui') }}</label>
4
+  <input type="text" id="cloud_tags_filter" />
5
+
2 6
   <input type="hidden" id="get_elements_url" value="{{ path('favorite_get', {
3 7
     'user_id': user_id, 
4 8
     'tags_ids_json' : ''
5 9
   }) }}" />
6 10
   <ul id="favorite_tags">
7 11
     {% for tag in tags %}
8
-      <li>
12
+      <li {% if loop.index0 > cloud_tags_limit_to_display %}style="display: none;"{% endif %}>
9 13
         <a id="filtering_tag_{{ tag.id }}" href="#" class="button tag">
10 14
           {{ tag.name }}
11 15
         </a>
12 16
       </li>
13 17
     {% endfor %}
14 18
   </ul>
19
+  
20
+  {% if tags|length > cloud_tags_limit_to_display %}
21
+  <div style="clear: both;"></div>
22
+    <a href="#" id="display_all_cloud_tag" >
23
+      {{ 'tags.cloud.display_more'|trans({}, 'userui') }}
24
+    </a>
25
+  {% endif %}
26
+  
15 27
   <div class="clearboth" ></div>
16 28
 {% endif %}

+ 5 - 0
web/bundles/muzichcore/css/main.css View File

@@ -1282,4 +1282,9 @@ li.element.shadows
1282 1282
    -moz-box-shadow: 3px 3px 3px #4F4F4F;
1283 1283
    -webkit-box-shadow: 3px 3px 3px #4F4F4F;
1284 1284
    box-shadow: 3px 3px 3px #4F4F4F;
1285
+}
1286
+
1287
+ul#favorite_tags a.button.highlight
1288
+{
1289
+  color: blue;
1285 1290
 }

+ 29 - 0
web/bundles/muzichcore/js/muzich.js View File

@@ -2224,4 +2224,33 @@ $(document).ready(function(){
2224 2224
     }
2225 2225
   });
2226 2226
 
2227
+  /*
2228
+   * Cloud tags
2229
+   */
2230
+  
2231
+  $('a#display_all_cloud_tag').click(function(){
2232
+    $('ul#favorite_tags li').show();
2233
+    $(this).hide();
2234
+  });
2235
+  
2236
+  $('input#cloud_tags_filter').keyup(function(){
2237
+    var search_string = $(this).val();
2238
+    
2239
+    $('ul#favorite_tags li a').removeClass('highlight');
2240
+    
2241
+    if (search_string.length > 1)
2242
+    {
2243
+      $('ul#favorite_tags li a').each(function(){
2244
+
2245
+        if ($(this).text().toUpperCase().search(search_string.toUpperCase()) != -1)
2246
+        {
2247
+          $(this).addClass('highlight')
2248
+        }
2249
+
2250
+      });
2251
+    }
2252
+    
2253
+  });
2254
+
2255
+
2227 2256
 });