瀏覽代碼

Ajouter un element caché: clic sur lien pour l'afficher.

bastien 13 年之前
父節點
當前提交
be5e81221b

+ 5 - 0
app/Resources/translations/navigationui.fr.yml 查看文件

@@ -17,5 +17,10 @@ registration:
17 17
 login:
18 18
   display:              J'ai déjà un compte
19 19
   
20
+home:
21
+  add_element:          Ajouter un élément
22
+  add_element_box:
23
+    close:              Fermer
24
+  
20 25
 title:
21 26
   hello:                Découvrez et partagez la musique !

+ 17 - 8
src/Muzich/HomeBundle/Resources/views/Home/index.html.twig 查看文件

@@ -4,17 +4,26 @@
4 4
 
5 5
 {% block content %}
6 6
 
7
-  <form action="{{ path('element_add') }}" method="post" {{ form_enctype(add_form) }}>
7
+  <div id="element_add_box" style="display: none;">
8 8
     
9
-    {% include "MuzichCoreBundle:Element:form.add.html.twig" with { 
10
-      'form'          : add_form, 
11
-      'form_name'     : add_form_name
12
-    } %}
9
+    <a href="#" id="element_add_close_link">
10
+      {{ 'home.add_element_box.close'|trans({}, 'navigationui') }} >>
11
+    </a>
12
+    
13
+    <form action="{{ path('element_add') }}" method="post" {{ form_enctype(add_form) }}>
14
+
15
+      {% include "MuzichCoreBundle:Element:form.add.html.twig" with { 
16
+        'form'          : add_form, 
17
+        'form_name'     : add_form_name
18
+      } %}
13 19
 
14
-    <input type="submit" />
15
-  </form>
20
+      <input type="submit" />
21
+    </form>
22
+  </div>
16 23
 
17
-  #######
24
+  <a href="#" id="element_add_link">
25
+    {{ 'home.add_element'|trans({}, 'navigationui') }} >>
26
+  </a>
18 27
 
19 28
   {% include "MuzichCoreBundle:SearchElement:form.html.twig" with { 
20 29
     'form_name'      : search_form_name,

+ 3 - 0
src/Muzich/HomeBundle/Resources/views/layout.html.twig 查看文件

@@ -3,6 +3,9 @@
3 3
 {% block css %}
4 4
 	<link href="{{ asset('bundles/muzichhome/css/home.css') }}" rel="stylesheet" media="screen" type="text/css" />
5 5
 {% endblock %}
6
+{% block js %}
7
+  <script src="{{ asset('bundles/muzichhome/js/home.js') }}" type="text/javascript"></script>
8
+{% endblock %}
6 9
 
7 10
 {% block main_content %}
8 11
   

+ 12 - 0
web/bundles/muzichhome/css/home.css 查看文件

@@ -4,4 +4,16 @@
4 4
 {
5 5
   float: right;
6 6
   text-decoration: none;
7
+}
8
+
9
+#container #element_add_link, #container #element_add_close_link
10
+{
11
+  font-size: 120%;
12
+  float: right;
13
+}
14
+
15
+#container #element_add_box
16
+{
17
+  background-color: #e3f6fd;
18
+  padding: 20px;
7 19
 }

+ 16 - 0
web/bundles/muzichhome/js/home.js 查看文件

@@ -0,0 +1,16 @@
1
+$(document).ready(function(){
2
+   
3
+   $('#element_add_link').click(function(){
4
+     $('#element_add_box').slideDown("slow");
5
+     $('#element_add_link').hide();
6
+     return false;
7
+   });   
8
+   
9
+   $('#element_add_close_link').click(function(){
10
+     $('#element_add_box').slideUp("slow");
11
+     $('#element_add_link').show();
12
+     return false;
13
+   }); 
14
+   
15
+   
16
+ });