Преглед на файлове

Evolution #830: Element show one: title !

Bastien Sevajol преди 11 години
родител
ревизия
f094965d03
променени са 2 файла, в които са добавени 10 реда и са изтрити 4 реда
  1. 9 3
      src/Muzich/HomeBundle/Controller/HomeController.php
  2. 1 1
      src/Muzich/HomeBundle/Resources/views/Home/index.html.twig

+ 9 - 3
src/Muzich/HomeBundle/Controller/HomeController.php Целия файл

@@ -14,7 +14,7 @@ class HomeController extends Controller
14 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 19
     if (!$search_object)
20 20
       $search_object = $this->getElementSearcher($count);
@@ -47,16 +47,22 @@ class HomeController extends Controller
47 47
       'display_launch_demo' => true,
48 48
       'login'            => $login,
49 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 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 62
     $es = $this->getNewElementSearcher();
57 63
     $es->setNoTags();
58 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 68
   protected function getEmailTokenIfExist()

+ 1 - 1
src/Muzich/HomeBundle/Resources/views/Home/index.html.twig Целия файл

@@ -4,7 +4,7 @@
4 4
   {% set login = false %}
5 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 8
 {% block mainbox_classes %}mainbox_margintop mainbox_nopadding{% endblock %}
9 9
 
10 10
 {% block content %}