Browse Source

Evolution #66: Ajout de tags: sablier

bastien 13 years ago
parent
commit
cc1653dd99

+ 1 - 1
src/Muzich/CoreBundle/Resources/views/Tag/tagFavoritesForm.html.twig View File

1
-<form action="{{ path('update_tag_favorites', { 'redirect' : redirect }) }}" method="post" {{ form_enctype(form) }}>
1
+<form name="{{ form_name }}" action="{{ path('update_tag_favorites', { 'redirect' : redirect }) }}" method="post" {{ form_enctype(form) }}>
2
   
2
   
3
   {{ form_errors(form) }}
3
   {{ form_errors(form) }}
4
 
4
 

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

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
-  
5
+    
6
   {% if display_specials_buttons is defined %}
6
   {% if display_specials_buttons is defined %}
7
     {% if display_specials_buttons == true %}
7
     {% if display_specials_buttons == true %}
8
       <br />
8
       <br />
13
     {% endif %}
13
     {% endif %}
14
   {% endif %}
14
   {% endif %}
15
   
15
   
16
+   <img id="tag_loader_{{ form_name }}" class="tag_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
16
    <input class="tags_prompt_list" id="tags_prompt_list_{{ form_name }}" name="tags" value=""> 
17
    <input class="tags_prompt_list" id="tags_prompt_list_{{ form_name }}" name="tags" value=""> 
17
 </div>
18
 </div>
18
 
19
 
53
         
54
         
54
         // ici il faut faire une ajax q pour obtenir la liste
55
         // ici il faut faire une ajax q pour obtenir la liste
55
         // ou a est un tableau de strings
56
         // ou a est un tableau de strings
56
-        
57
+        $('#tag_loader_{{ form_name }}').css('display', 'block');
57
         $.getJSON('/app_dev.php/fr/search/tag/'+req.term, function(data) {
58
         $.getJSON('/app_dev.php/fr/search/tag/'+req.term, function(data) {
58
           responseFn( data );
59
           responseFn( data );
60
+          $('#tag_loader_{{ form_name }}').css('display', 'none');
59
         });
61
         });
60
       },
62
       },
61
       minLength: 2,
63
       minLength: 2,

+ 1 - 1
src/Muzich/GroupBundle/Resources/views/Default/edit.html.twig View File

6
 
6
 
7
   <h2>Edition du groupe {{ group.name }}</h2>
7
   <h2>Edition du groupe {{ group.name }}</h2>
8
 
8
 
9
-  <form action="{{ path('group_update', { 'slug': group.slug }) }}" method="post" {{ form_enctype(form) }}>
9
+  <form name="{{ form_name }}" action="{{ path('group_update', { 'slug': group.slug }) }}" method="post" {{ form_enctype(form) }}>
10
     
10
     
11
     {% include "MuzichGroupBundle:Form:form.html.twig" %}
11
     {% include "MuzichGroupBundle:Form:form.html.twig" %}
12
 
12
 

+ 1 - 1
src/Muzich/GroupBundle/Resources/views/Default/myList.html.twig View File

24
 
24
 
25
   <h2>Ajouter un groupe</h2>
25
   <h2>Ajouter un groupe</h2>
26
 
26
 
27
-  <form action="{{ path('group_add') }}" method="post" {{ form_enctype(form_new) }}>
27
+  <form name="{{ form_new_name }}" action="{{ path('group_add') }}" method="post" {{ form_enctype(form_new) }}>
28
     
28
     
29
     {% include "MuzichGroupBundle:Form:form.html.twig" with { 'form': form_new, 'form_name': form_new_name } %}
29
     {% include "MuzichGroupBundle:Form:form.html.twig" with { 'form': form_new, 'form_name': form_new_name } %}
30
 
30
 

+ 2 - 2
src/Muzich/HomeBundle/Resources/views/Home/index.html.twig View File

10
       {{ 'home.add_element_box.close'|trans({}, 'navigationui') }} >>
10
       {{ 'home.add_element_box.close'|trans({}, 'navigationui') }} >>
11
     </a>
11
     </a>
12
     
12
     
13
-    <form action="{{ path('element_add') }}" method="post" {{ form_enctype(add_form) }}>
13
+    <form name="{{ add_form_name }}" action="{{ path('element_add') }}" method="post" {{ form_enctype(add_form) }}>
14
 
14
 
15
       {% include "MuzichCoreBundle:Element:form.add.html.twig" with { 
15
       {% include "MuzichCoreBundle:Element:form.add.html.twig" with { 
16
         'form'          : add_form, 
16
         'form'          : add_form, 
25
     {{ 'home.add_element'|trans({}, 'navigationui') }} >>
25
     {{ 'home.add_element'|trans({}, 'navigationui') }} >>
26
   </a>
26
   </a>
27
 
27
 
28
-  <form action="{{ path('search_elements') }}" method="post" {{ form_enctype(search_form) }}>
28
+  <form name="{{ search_form_name }}" 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,
31
       'form_name'               : search_form_name,

+ 1 - 1
src/Muzich/HomeBundle/Resources/views/Show/showGroup.html.twig View File

27
   
27
   
28
   {% if his_group or group.open %}
28
   {% if his_group or group.open %}
29
   
29
   
30
-    <form action="{{ path('element_add', {'group_slug' : group.slug}) }}" method="post" {{ form_enctype(add_form) }}>
30
+    <form name="{{ add_form_name }}" action="{{ path('element_add', {'group_slug' : group.slug}) }}" method="post" {{ form_enctype(add_form) }}>
31
 
31
 
32
       {% include "MuzichCoreBundle:Element:form.add.html.twig" with { 'form': add_form, 'form_name': add_form_name } %}
32
       {% include "MuzichCoreBundle:Element:form.add.html.twig" with { 'form': add_form, 'form_name': add_form_name } %}
33
 
33
 

+ 7 - 1
web/bundles/muzichcore/css/main.css View File

323
 border: 1px solid #ccc;
323
 border: 1px solid #ccc;
324
 overflow: hidden;
324
 overflow: hidden;
325
 padding: 0 0 1px 3px;
325
 padding: 0 0 1px 3px;
326
-min-height:48px;
327
 }
326
 }
328
 ul.tagbox li {
327
 ul.tagbox li {
329
 margin:0;
328
 margin:0;
480
     color-stop(0.49, rgb(168,238,255)),
479
     color-stop(0.49, rgb(168,238,255)),
481
     color-stop(1, rgb(189,241,254))
480
     color-stop(1, rgb(189,241,254))
482
   );
481
   );
482
+}
483
+
484
+.tag_loader
485
+{
486
+  float: right;
487
+  margin-top: 36px;
488
+  margin-left: 5px;
483
 }
489
 }

BIN
web/bundles/muzichcore/img/ajax-loader.gif View File


+ 6 - 0
web/js/tags/jquery.tagBox.js View File

63
           input = $(this);
63
           input = $(this);
64
 
64
 
65
           // Ici il faut faire un ajax q pour connaitre l'id, on a que le string
65
           // Ici il faut faire un ajax q pour connaitre l'id, on a que le string
66
+          // ajax loader gif
67
+          $('#tag_loader_'+options.form_name).css('display', 'block');
68
+          // On bloque le submit le temps de la validation du tag
69
+          $('form[name="'+options.form_name+'"] input[type="submit"]').attr('disabled', 'disabled');
66
           $.getJSON('/app_dev.php/fr/search/tagid/'+$(this).val(), function(data) {
70
           $.getJSON('/app_dev.php/fr/search/tagid/'+$(this).val(), function(data) {
67
             if (isInteger(data))
71
             if (isInteger(data))
68
             {
72
             {
69
               self.addTag(input.val(), data, options.form_name, false);
73
               self.addTag(input.val(), data, options.form_name, false);
70
               input.val("");
74
               input.val("");
75
+              $('#tag_loader_'+options.form_name).css('display', 'none');
76
+              $('form[name="'+options.form_name+'"] input[type="submit"]').removeAttr('disabled');
71
             }
77
             }
72
           });
78
           });
73
 
79