Browse Source

Evolution #780: Lien permanent

Bastien Sevajol 10 years ago
parent
commit
54f41abc24

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

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

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

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

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

@@ -121,7 +121,11 @@ element_new_get:
121 121
 element_remove_from_group:
122 122
   pattern: /ajax/group/{group_id}/remove-element/{element_id}/{token}
123 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 131
 ajax_tag_add_to_favorites:
@@ -217,4 +221,4 @@ share_from:
217 221
 get_csrf_token:
218 222
   pattern: /ajax/getcsrf
219 223
   defaults: { _controller: MuzichCoreBundle:Core:getCsrfToken }
220
-  
224
+  

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

@@ -110,7 +110,8 @@ security:
110 110
         - { path: ^/(?:fr|en)/group, role: IS_AUTHENTICATED_ANONYMOUSLY }
111 111
         - { path: ^/(?:fr|en)/search, role: IS_AUTHENTICATED_ANONYMOUSLY }
112 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 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,11 +284,17 @@
284 284
       
285 285
       <span class="element_name">
286 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 291
             {{ element.name }}
289 292
           </a>
290 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 298
             {{ element.name }}
293 299
           </a>
294 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,11 +13,12 @@ class HomeController extends Controller
13 13
    * Page d'accueil ("home") de l'utilisateur. Cette page regroupe le fil
14 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 22
     $user = $this->getUser(true, array('join' => array(
22 23
       'groups_owned'
23 24
     )), true);
@@ -32,7 +33,7 @@ class HomeController extends Controller
32 33
     
33 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 37
       'search_tags_id'   => $search_object->getTags(),
37 38
       'ids_display'      => $search_object->getIdsDisplay(),
38 39
       'user'             => $user,
@@ -46,7 +47,15 @@ class HomeController extends Controller
46 47
       'display_launch_demo' => true,
47 48
       'login'            => $login,
48 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 61
   protected function getEmailTokenIfExist()