Browse Source

Evolution #830: Element show one: title !

Bastien Sevajol 11 years ago
parent
commit
f094965d03

+ 9 - 3
src/Muzich/HomeBundle/Controller/HomeController.php View File

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
    */
16
    */
17
-  public function indexAction($count = null, $network = null, $login = false, $search_object = null, $context = 'home')
17
+  public function indexAction($count = null, $network = null, $login = false, $search_object = null, $context = 'home', $page_title = null)
18
   {
18
   {
19
     if (!$search_object)
19
     if (!$search_object)
20
       $search_object = $this->getElementSearcher($count);
20
       $search_object = $this->getElementSearcher($count);
47
       'display_launch_demo' => true,
47
       'display_launch_demo' => true,
48
       'login'            => $login,
48
       'login'            => $login,
49
       'email_token'      => $this->getEmailTokenIfExist(),
49
       'email_token'      => $this->getEmailTokenIfExist(),
50
-      'elements_context' => $context
50
+      'elements_context' => $context,
51
+      'page_title'       => $page_title
51
     ));
52
     ));
52
   }
53
   }
53
   
54
   
54
   public function showOneElementAction($element_id)
55
   public function showOneElementAction($element_id)
55
   {
56
   {
57
+    $page_title = null;
58
+    
59
+    if (($element = $this->getElementWithId($element_id)))
60
+      $page_title = $element->getName();
61
+    
56
     $es = $this->getNewElementSearcher();
62
     $es = $this->getNewElementSearcher();
57
     $es->setNoTags();
63
     $es->setNoTags();
58
     $es->setIds(array($element_id));
64
     $es->setIds(array($element_id));
59
-    return $this->indexAction(null, null, false, $es, 'one');
65
+    return $this->indexAction(null, null, false, $es, 'one', $page_title);
60
   }
66
   }
61
   
67
   
62
   protected function getEmailTokenIfExist()
68
   protected function getEmailTokenIfExist()

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

4
   {% set login = false %}
4
   {% set login = false %}
5
 {% endif %}
5
 {% endif %}
6
 
6
 
7
-{% block title %}{{ 'title.home'|trans({}, 'userui') }}{% endblock %}
7
+{% block title %}{% if page_title %}{{ page_title }}{% else %}{{ 'title.home'|trans({}, 'userui') }}{% endif %}{% endblock %}
8
 {% block mainbox_classes %}mainbox_margintop mainbox_nopadding{% endblock %}
8
 {% block mainbox_classes %}mainbox_margintop mainbox_nopadding{% endblock %}
9
 
9
 
10
 {% block content %}
10
 {% block content %}