Browse Source

Javascript pour afficher/cacher le lecteur embed.

bastien 13 years ago
parent
commit
cb2e3369d6

+ 4 - 1
app/Resources/translations/elements.fr.yml View File

@@ -8,4 +8,7 @@ element:
8 8
     remove:             Retirer de mes favoris
9 9
   add:
10 10
     group:
11
-      will_be_in:       L'élément sera ajouté dans le groupe
11
+      will_be_in:       L'élément sera ajouté dans le groupe
12
+  show:
13
+    close_embed:        Cacher le lecteur
14
+    open_embed:         Afficher le lecteur

+ 39 - 11
src/Muzich/CoreBundle/Resources/views/SearchElement/default.html.twig View File

@@ -1,14 +1,31 @@
1 1
 
2 2
 {% if elements|length %}
3
-  <ul>
3
+  <ul class="elements">
4 4
     {% for element in elements %} 
5
-      <li id="element_{{ element.id }}">
5
+      <li class="element" id="element_{{ element.id }}">
6
+        
7
+        {% if element.embed %}
8
+          <img src="{{ asset('bundles/muzichcore/img/1324917083_player.png') }}" alt="player" />
9
+        {% else %}
10
+          <img src="{{ asset('bundles/muzichcore/img/1324917097_link.png') }}" alt="link" />
11
+        {% endif %}
12
+        
6 13
         {% if element.group %}
7
-          <b>({{ element.group.name }})</b>
14
+          <b class="element_group">
15
+            (<a href="{{ path('show_group', {'slug': element.group.slug}) }}">{{ element.group.name }}</a>)
16
+          </b>
8 17
         {% endif %}
9
-        {{ element.name }} ({{ element.owner.username }})
10
-          <a href="{{ element.url }}" target="_blank">link</a>
11 18
           
19
+        <span class="element_name">
20
+          {{ element.name }}
21
+        </span> 
22
+        
23
+        <span class="element_author">
24
+          (<a href="{{ path('show_group', {'slug': element.owner.slug}) }}">{{ element.owner.name }}</a>)
25
+        </span>
26
+        
27
+        <a class="element_link" href="{{ element.url }}" target="_blank">link</a>
28
+                  
12 29
           {% if element.getCountFavorite %}
13 30
             | <a href="{{ path('favorite_remove', { 'id': element.id, 'token': user.personalHash }) }}" >
14 31
               {{ 'element.favorite.remove'|trans({}, 'elements') }}
@@ -19,18 +36,29 @@
19 36
             </a>
20 37
           {% endif %}
21 38
           
22
-          <ul>
39
+          {% if element.embed %}
40
+            {% autoescape false %}
41
+              <div id="embed_{{ element.id }}" class="element_embed" style="display: none;">
42
+                {{ element.embed }}
43
+              </div>
44
+            {% endautoescape %}
45
+          {% endif %}
46
+          
47
+          <ul class="element_tags">
23 48
             {% for tag in element.tags %} 
24
-              <li>
49
+              <li class="element_tag">
25 50
                 {{ tag.name }}
26 51
               </li>
27 52
             {% endfor %} 
28 53
           </ul>
29
-
54
+            
30 55
           {% if element.embed %}
31
-            {% autoescape false %}
32
-              {{ element.embed }}
33
-            {% endautoescape %}
56
+          <a href="#" class="element_embed_close_link" style="display: none;">
57
+            {{ 'element.show.close_embed'|trans({}, 'elements') }}
58
+          </a>
59
+          <a href="#" class="element_embed_open_link">
60
+            {{ 'element.show.open_embed'|trans({}, 'elements') }}
61
+          </a>
34 62
           {% endif %}
35 63
 
36 64
       </li>

+ 19 - 2
web/bundles/muzichcore/css/main.css View File

@@ -292,7 +292,7 @@ ul.inline li
292 292
 }
293 293
 
294 294
 
295
-/*  (TMP) Debut CSS pour tags */
295
+/*  Debut CSS pour tags */
296 296
 
297 297
 pre code {background: #ccc; padding:2px 0; display: block; margin-top:4px;}
298 298
 .ui-autocomplete {
@@ -370,4 +370,21 @@ background-position: 7px;
370 370
 } 
371 371
 
372 372
 
373
-/* Fin CSS pour tags */
373
+/* Fin CSS pour tags */
374
+
375
+/* Debut CSS pour elements */
376
+
377
+.elements ul.element_tags
378
+{
379
+  margin-left: 10px;
380
+  margin-top: 0px;
381
+}
382
+  
383
+.elements ul.element_tags li
384
+{
385
+  display: inline;
386
+  font-size: 90%;
387
+}
388
+
389
+
390
+/* FIN CSS pour elements */

BIN
web/bundles/muzichcore/img/1324917083_player.png View File


BIN
web/bundles/muzichcore/img/1324917097_link.png View File


+ 27 - 0
web/bundles/muzichhome/js/home.js View File

@@ -1,16 +1,43 @@
1 1
 $(document).ready(function(){
2 2
    
3
+   // Ouverture de la zone "ajouter un element""
3 4
    $('#element_add_link').click(function(){
4 5
      $('#element_add_box').slideDown("slow");
5 6
      $('#element_add_link').hide();
6 7
      return false;
7 8
    });   
8 9
    
10
+   // Fermeture de la zone "ajouter un element""
9 11
    $('#element_add_close_link').click(function(){
10 12
      $('#element_add_box').slideUp("slow");
11 13
      $('#element_add_link').show();
12 14
      return false;
13 15
    }); 
14 16
    
17
+//   // Affichage du/des embed si existant
18
+//   $('li.element').hover(function(){     
19
+//     $(this).find('div.element_embed').each(function(i){ 
20
+//       if ($(this).css('display') == 'none')
21
+//       {
22
+//         $(this).show();        
23
+//       }
24
+//     });
25
+//   }, function(){});
26
+
27
+   // Affichage du/des embed
28
+   $('a.element_embed_open_link').click(function(){
29
+     $('a.element_embed_open_link').hide();
30
+     $('a.element_embed_close_link').show();
31
+     $(this).parent('li.element').find('div.element_embed').show();
32
+     return false;
33
+   });
34
+   
35
+   // Fermeture du embed si demandé
36
+   $('a.element_embed_close_link').click(function(){
37
+     $('a.element_embed_open_link').show();
38
+     $('a.element_embed_close_link').hide();
39
+     $(this).parent('li.element').find('div.element_embed').hide();
40
+     return false;
41
+   });
15 42
    
16 43
  });