Browse Source

Evolution #91: Favoris: Nouvelle présentation: refactorisation et inclusion sur la page favoris de autre que soit.

bastien 13 years ago
parent
commit
496a0a2d7d

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

@@ -0,0 +1,13 @@
1
+{% if tags|length %}
2
+  <input type="hidden" id="get_elements_url" value="{{ path('favorite_get', {'user_id': user_id, 'tags_ids_json' : ''}) }}" />
3
+  <ul id="favorite_tags">
4
+    {% for tag in tags %}
5
+      <li>
6
+        <a href="#{{ tag.id }}" class="button tag">
7
+          {{ tag.name }}
8
+        </a>
9
+      </li>
10
+    {% endfor %}
11
+  </ul>
12
+  <div class="clearboth" ></div>
13
+{% endif %}

+ 15 - 3
src/Muzich/FavoriteBundle/Controller/FavoriteController.php View File

@@ -172,10 +172,22 @@ class FavoriteController extends Controller
172 172
       'count'    => $this->container->getParameter('search_default_count')
173 173
     ));
174 174
     
175
+    $tags = $this->getDoctrine()->getRepository('MuzichCoreBundle:UsersElementsFavorites')
176
+      ->getTags($viewed_user->getId())      
177
+    ;
178
+    
179
+    $tags_id = array();
180
+    foreach ($tags as $tag)
181
+    {
182
+      $tags_id[] = $tag->getId();
183
+    }
184
+    
175 185
     return array(
176
-      'user'        => $this->getUser(),
177
-      'viewed_user' => $viewed_user,
178
-      'elements'    => $search_object->getElements($this->getDoctrine(), $this->getUserId())
186
+      'tags'          => $tags,
187
+      'tags_id_json'  => json_encode($tags_id),
188
+      'user'          => $this->getUser(),
189
+      'viewed_user'   => $viewed_user,
190
+      'elements'      => $search_object->getElements($this->getDoctrine(), $this->getUserId())
179 191
     );
180 192
   }
181 193
   

+ 4 - 14
src/Muzich/FavoriteBundle/Resources/views/Favorite/myList.html.twig View File

@@ -12,20 +12,10 @@
12 12
 
13 13
   <h2>{{ 'favorites.your_favorites'|trans({}, 'network') }}</h2>
14 14
 
15
-  {% if tags|length %}
16
-    <input type="hidden" id="get_elements_url" value="{{ path('favorite_get', {'user_id': app.user.id, 'tags_ids_json' : ''}) }}" />
17
-    <ul id="favorite_tags">
18
-      {% for tag in tags %}
19
-        <li>
20
-          <a href="#{{ tag.id }}" class="button tag">
21
-            {{ tag.name }}
22
-          </a>
23
-        </li>
24
-      {% endfor %}
25
-    </ul>
26
-    <div class="clearboth" ></div>
27
-  {% endif %}
28
-
15
+  {% include "MuzichCoreBundle:Tag:tagsList.html.twig" with {
16
+    'user_id' : app.user.id
17
+  } %}
18
+  
29 19
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
30 20
     
31 21
   <div class="elements_loader_div">

+ 17 - 0
src/Muzich/FavoriteBundle/Resources/views/Favorite/userList.html.twig View File

@@ -12,6 +12,23 @@
12 12
 
13 13
   <h2>{{ 'favorites.user_favorites'|trans({'%name%' : viewed_user.name}, 'network') }}</h2>
14 14
 
15
+  {% include "MuzichCoreBundle:Tag:tagsList.html.twig" with {
16
+    'user_id' : viewed_user.id
17
+  } %}
18
+
15 19
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
16 20
     
21
+  <div class="elements_loader_div">
22
+    <img class="elements_more_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading" />
23
+  </div>
24
+  
25
+  {% if elements|length %}
26
+     <span class="elements_more">
27
+       <input type="hidden" id="more_elements_url" value="{{ path('favorite_get', {'user_id': viewed_user.id, 'tags_ids_json' : ''}) }}" />
28
+       <a href="{{ path('favorite_get', {'user_id': viewed_user.id, 'tags_ids_json' : tags_id_json}) }}" class="elements_more button">
29
+         {{ 'more'|trans({}, 'userui') }}
30
+       </a>
31
+     </span>
32
+  {% endif %}
33
+    
17 34
 {% endblock %}