Browse Source

Evolution #780: Lien permanent

Bastien Sevajol 11 years ago
parent
commit
54f41abc24

+ 1 - 0
app/Resources/translations/elements.en.yml View File

12
   nofound_anymore:      Share not found (maybe deleted by owner)
12
   nofound_anymore:      Share not found (maybe deleted by owner)
13
   
13
   
14
 element:
14
 element:
15
+  permalink:            Permalink
15
   favorite:
16
   favorite:
16
     add:                Add to faves
17
     add:                Add to faves
17
     remove:             Remove from faves
18
     remove:             Remove from faves

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

11
   nofound_anymore:      Le partage est introuvable (il peut avoir été supprimé par son auteur)
11
   nofound_anymore:      Le partage est introuvable (il peut avoir été supprimé par son auteur)
12
   
12
   
13
 element:
13
 element:
14
+  permalink:            Lien permanant
14
   favorite:
15
   favorite:
15
     add:                Ajouter à mes favoris
16
     add:                Ajouter à mes favoris
16
     remove:             Retirer de mes favoris
17
     remove:             Retirer de mes favoris

+ 6 - 2
src/Muzich/CoreBundle/Resources/config/routing.yml View File

121
 element_remove_from_group:
121
 element_remove_from_group:
122
   pattern: /ajax/group/{group_id}/remove-element/{element_id}/{token}
122
   pattern: /ajax/group/{group_id}/remove-element/{element_id}/{token}
123
   defaults: { _controller: MuzichCoreBundle:Element:removeFromGroup }
123
   defaults: { _controller: MuzichCoreBundle:Element:removeFromGroup }
124
-  
124
+
125
+element_show_one:
126
+  pattern: /song/{element_id}/{element_slug}
127
+  defaults: { _controller: MuzichHomeBundle:Home:showOneElement }
128
+
125
 ##
129
 ##
126
 
130
 
127
 ajax_tag_add_to_favorites:
131
 ajax_tag_add_to_favorites:
217
 get_csrf_token:
221
 get_csrf_token:
218
   pattern: /ajax/getcsrf
222
   pattern: /ajax/getcsrf
219
   defaults: { _controller: MuzichCoreBundle:Core:getCsrfToken }
223
   defaults: { _controller: MuzichCoreBundle:Core:getCsrfToken }
220
-  
224
+  

+ 2 - 1
src/Muzich/CoreBundle/Resources/config/security.yml View File

110
         - { path: ^/(?:fr|en)/group, role: IS_AUTHENTICATED_ANONYMOUSLY }
110
         - { path: ^/(?:fr|en)/group, role: IS_AUTHENTICATED_ANONYMOUSLY }
111
         - { path: ^/(?:fr|en)/search, role: IS_AUTHENTICATED_ANONYMOUSLY }
111
         - { path: ^/(?:fr|en)/search, role: IS_AUTHENTICATED_ANONYMOUSLY }
112
         - { path: ^/(?:fr|en)/playlist, role: IS_AUTHENTICATED_ANONYMOUSLY }
112
         - { path: ^/(?:fr|en)/playlist, role: IS_AUTHENTICATED_ANONYMOUSLY }
113
-        - { path: ^/(?:fr|en)/my-groups/add, role: IS_AUTHENTICATED_ANONYMOUSLY }                  
113
+        - { path: ^/(?:fr|en)/my-groups/add, role: IS_AUTHENTICATED_ANONYMOUSLY }  
114
+        - { path: ^/(?:fr|en)/song, role: IS_AUTHENTICATED_ANONYMOUSLY }                  
114
           
115
           
115
         - { path: ^/, roles: ROLE_USER }
116
         - { path: ^/, roles: ROLE_USER }
116
         
117
         

+ 0 - 0
src/Muzich/CoreBundle/Resources/views/Element/share_from.html.twig View File


+ 8 - 2
src/Muzich/CoreBundle/Resources/views/SearchElement/element.html.twig View File

284
       
284
       
285
       <span class="element_name">
285
       <span class="element_name">
286
         {% if element.embed %}
286
         {% if element.embed %}
287
-          <a href="#" class="element_open element_name_embed_open_link">
287
+          <a href="{{ path('element_show_one', {
288
+            'element_id' : element.id,
289
+            'element_slug' : element.slug
290
+          }) }}" class="element_open element_name_embed_open_link">
288
             {{ element.name }}
291
             {{ element.name }}
289
           </a>
292
           </a>
290
         {% else %}
293
         {% else %}
291
-          <a href="{{ element.url }}" class="element_open" target="_blank">
294
+          <a href="{{ path('element_show_one', {
295
+            'element_id' : element.id,
296
+            'element_slug' : element.slug
297
+          }) }}" class="element_open" target="_blank">
292
             {{ element.name }}
298
             {{ element.name }}
293
           </a>
299
           </a>
294
         {% endif %}
300
         {% endif %}

+ 0 - 0
src/Muzich/CoreBundle/Resources/views/layout_iframe.html.twig View File


+ 14 - 5
src/Muzich/HomeBundle/Controller/HomeController.php View File

13
    * Page d'accueil ("home") de l'utilisateur. Cette page regroupe le fil
13
    * Page d'accueil ("home") de l'utilisateur. Cette page regroupe le fil
14
    * d'éléments général et personalisable et de quoi ajouter un élément.
14
    * d'éléments général et personalisable et de quoi ajouter un élément.
15
    * 
15
    * 
16
-   * @Template()
17
    */
16
    */
18
-  public function indexAction($count = null, $network = null, $login = false)
17
+  public function indexAction($count = null, $network = null, $login = false, $search_object = null)
19
   {
18
   {
20
-    $search_object = $this->getElementSearcher($count);
19
+    if (!$search_object)
20
+      $search_object = $this->getElementSearcher($count);
21
+    
21
     $user = $this->getUser(true, array('join' => array(
22
     $user = $this->getUser(true, array('join' => array(
22
       'groups_owned'
23
       'groups_owned'
23
     )), true);
24
     )), true);
32
     
33
     
33
     $elements = $search_object->getElements($this->getDoctrine(), $this->getUserId(true));
34
     $elements = $search_object->getElements($this->getDoctrine(), $this->getUserId(true));
34
     
35
     
35
-    return array(
36
+    return $this->render('MuzichHomeBundle:Home:index.html.twig', array(
36
       'search_tags_id'   => $search_object->getTags(),
37
       'search_tags_id'   => $search_object->getTags(),
37
       'ids_display'      => $search_object->getIdsDisplay(),
38
       'ids_display'      => $search_object->getIdsDisplay(),
38
       'user'             => $user,
39
       'user'             => $user,
46
       'display_launch_demo' => true,
47
       'display_launch_demo' => true,
47
       'login'            => $login,
48
       'login'            => $login,
48
       'email_token'      => $this->getEmailTokenIfExist()
49
       'email_token'      => $this->getEmailTokenIfExist()
49
-    );
50
+    ));
51
+  }
52
+  
53
+  public function showOneElementAction($element_id)
54
+  {
55
+    $es = $this->getNewElementSearcher();
56
+    $es->setNoTags();
57
+    $es->setIds(array($element_id));
58
+    return $this->indexAction(null, null, false, $es);
50
   }
59
   }
51
   
60
   
52
   protected function getEmailTokenIfExist()
61
   protected function getEmailTokenIfExist()