Browse Source

bug fix: tags list: suppression des anciens li et length > 0 et pas > 1

bastien 13 years ago
parent
commit
01cfae1add
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/Muzich/CoreBundle/Resources/views/Tag/tagsPrompt.html.twig

+ 5 - 3
src/Muzich/CoreBundle/Resources/views/Tag/tagsPrompt.html.twig View File

@@ -15,8 +15,8 @@
15 15
   
16 16
    <input class="tags_prompt_list" id="tags_prompt_list_{{ form_name }}" name="tags" value=""> 
17 17
    <div id="search_tag_{{ form_name }}" class="search_tag_list" style="display: none;">
18
-     <img id="tag_loader_{{ form_name }}" class="tag_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
19 18
      <span class="info"></span>
19
+     <img id="tag_loader_{{ form_name }}" class="tag_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
20 20
      <ul class="search_tag_list"></ul>
21 21
      <a class="more" href="#" style="display: none;">Afficher les autres tags correspondant a la recherche</a>
22 22
    </div>
@@ -96,6 +96,8 @@
96 96
       $('#tag_loader_'+form_name).show();
97 97
       // On cache la liste de tags
98 98
       search_tag_list = divtags.find('ul.search_tag_list');
99
+      // On supprime les anciens li
100
+      search_tag_list.find('li').remove();
99 101
       search_tag_list.hide();
100 102
       // Et on affiche une info
101 103
       span_info = divtags.find('span.info');
@@ -126,12 +128,12 @@
126 128
           // Si c'est un succés
127 129
           else if (status == 'success')
128 130
           {
129
-            if (tags.length > 1)
131
+            if (tags.length > 0)
130 132
             {
131 133
               more = false;
132 134
               // Pour chaque tags retournés
133 135
               for (i in tags)
134
-              {
136
+              {                
135 137
                 // On construit un li
136 138
                 li_tag = 
137 139
                   $('<li>').append(