浏览代码

Evolution #193: Bouton ajout

Bastien Sevajol 12 年前
父节点
当前提交
be9571572d

+ 3 - 1
src/Muzich/HomeBundle/Controller/ShowController.php 查看文件

65
       'count_owned'     => count($element_ids_owned),
65
       'count_owned'     => count($element_ids_owned),
66
       'count_favorited' => $count_favorited,
66
       'count_favorited' => $count_favorited,
67
       'count_favorited_users' => $count_favorited_users,
67
       'count_favorited_users' => $count_favorited_users,
68
-      'count_followers' => $count_followers
68
+      'count_followers' => $count_followers,
69
+      'add_form'        => ($this->getUserId() == $viewed_user->getId())?$this->getAddForm()->createView():null,
70
+      'add_form_name'   => 'add'
69
     );
71
     );
70
   }
72
   }
71
   
73
   

+ 22 - 0
src/Muzich/HomeBundle/Resources/views/Show/showUser.html.twig 查看文件

25
   
25
   
26
 
26
 
27
   <h2>{{ 'user.show.title'|trans({'%name%' : viewed_user.name}, 'users') }}</h2>
27
   <h2>{{ 'user.show.title'|trans({'%name%' : viewed_user.name}, 'users') }}</h2>
28
+
29
+  {% if app.user.id == viewed_user.id %}
30
+    <div id="element_add_box" style="display: none;">    
31
+    
32
+      <a href="#" id="element_add_close_link" class="button">
33
+        &lt;&lt; {{ 'home.add_element_box.close'|trans({}, 'navigationui') }}
34
+      </a>
35
+
36
+      <form novalidate name="{{ add_form_name }}" action="{{ path('element_add') }}" method="post" {{ form_enctype(add_form) }}>
37
+
38
+        {% include "MuzichCoreBundle:Element:form.add.html.twig" with { 
39
+          'form'          : add_form, 
40
+          'form_name'     : add_form_name
41
+        } %}
42
+
43
+      </form>
44
+    </div>
45
+
46
+    <a href="#" id="element_add_link" class="button">
47
+      {{ 'home.add_element'|trans({}, 'navigationui') }} &gt;&gt;
48
+    </a>
49
+  {% endif %}
28
   
50
   
29
   <div class="reputation">
51
   <div class="reputation">
30
     {{ 'user.reputation.name'|trans({}, 'users') }}: 
52
     {{ 'user.reputation.name'|trans({}, 'users') }}: