Преглед изворни кода

Couche visuelle pour message flashs.

bastien пре 13 година
родитељ
комит
83ec75833a

+ 0 - 36
app/logs/prod.log Прегледај датотеку

@@ -1,36 +0,0 @@
1
-[2011-09-06 10:17:47] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /" (uncaught exception) at /home/bux/NetBeansProjects/muzi.ch/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/RouterListener.php line 85 [] []
2
-[2011-09-06 10:18:52] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /" (uncaught exception) at /home/bux/NetBeansProjects/muzi.ch/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/RouterListener.php line 85 [] []
3
-[2011-09-09 10:43:54] security.INFO: Populated SecurityContext with an anonymous Token [] []
4
-[2011-09-09 10:43:54] request.INFO: Matched route "index" (parameters: "_controller": "Muzich\IndexBundle\Controller\IndexController::indexAction", "_route": "index") [] []
5
-[2011-09-09 10:43:54] request.CRITICAL: Twig_Error_Syntax: The function "code" does not exist in {} at line 7 (uncaught exception) at /home/bux/NetBeansProjects/muzich/vendor/twig/lib/Twig/Node/Expression/Function.php line 22 [] []
6
-[2011-09-09 17:10:54] security.INFO: Populated SecurityContext with an anonymous Token [] []
7
-[2011-09-09 17:10:54] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /images/favicon.ico" (uncaught exception) at /home/bux/NetBeansProjects/muzich/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/RouterListener.php line 85 [] []
8
-[2011-09-09 17:10:56] security.INFO: Populated SecurityContext with an anonymous Token [] []
9
-[2011-09-09 17:10:56] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /images/favicon.ico" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
10
-[2011-09-09 17:10:57] security.INFO: Populated SecurityContext with an anonymous Token [] []
11
-[2011-09-09 17:10:57] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /images/favicon.ico" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
12
-[2011-09-09 17:12:45] security.INFO: Populated SecurityContext with an anonymous Token [] []
13
-[2011-09-09 17:12:45] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /images/favicon.ico" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
14
-[2011-09-09 17:14:06] security.INFO: Populated SecurityContext with an anonymous Token [] []
15
-[2011-09-09 17:14:06] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /images/favicon.ico" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
16
-[2011-09-09 17:14:07] security.INFO: Populated SecurityContext with an anonymous Token [] []
17
-[2011-09-09 17:14:07] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /images/favicon.ico" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
18
-[2011-09-09 17:14:08] security.INFO: Populated SecurityContext with an anonymous Token [] []
19
-[2011-09-09 17:14:08] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /images/favicon.ico" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
20
-[2011-09-10 11:45:12] security.INFO: Populated SecurityContext with an anonymous Token [] []
21
-[2011-09-10 11:45:12] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /bundles/muzichindex/css/index.css" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
22
-[2011-09-10 11:49:51] security.DEBUG: Read SecurityContext from the session [] []
23
-[2011-09-10 11:49:51] security.DEBUG: Reloading user from user provider. [] []
24
-[2011-09-10 11:49:52] security.DEBUG: Username "bux" was reloaded from user provider. [] []
25
-[2011-09-10 11:49:52] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /bundles/muzichhome/css/home.css" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
26
-[2011-09-10 11:49:52] security.DEBUG: Write SecurityContext in the session [] []
27
-[2011-09-10 11:51:43] security.DEBUG: Read SecurityContext from the session [] []
28
-[2011-09-10 11:51:43] security.DEBUG: Reloading user from user provider. [] []
29
-[2011-09-10 11:51:43] security.DEBUG: Username "bux" was reloaded from user provider. [] []
30
-[2011-09-10 11:51:43] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /bundles/muzichhome/css/home.css" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
31
-[2011-09-10 11:51:43] security.DEBUG: Write SecurityContext in the session [] []
32
-[2011-09-10 11:51:57] security.DEBUG: Read SecurityContext from the session [] []
33
-[2011-09-10 11:51:57] security.DEBUG: Reloading user from user provider. [] []
34
-[2011-09-10 11:51:57] security.DEBUG: Username "bux" was reloaded from user provider. [] []
35
-[2011-09-10 11:51:57] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /bundles/muzichhome/css/home.css" (uncaught exception) at /home/bux/NetBeansProjects/muzich/app/cache/prod/classes.php line 4539 [] []
36
-[2011-09-10 11:51:57] security.DEBUG: Write SecurityContext in the session [] []

+ 11 - 1
src/Muzich/CoreBundle/Resources/views/layout.html.twig Прегледај датотеку

@@ -15,10 +15,13 @@
15 15
 	<link href="{{ asset('bundles/muzichcore/css/base.css') }}" rel="stylesheet" media="screen" type="text/css" />
16 16
 	<link href="{{ asset('bundles/muzichcore/css/main.css') }}" rel="stylesheet" media="screen" type="text/css" />
17 17
   {% block css %}{% endblock %}
18
-	<script src="{{ asset('bundles/muzichcore/js/jquery-1.6.4.min.js') }}" type="text/javascript"></script>
18
+	<script src="{{ asset('js/jquery-1.6.4.min.js') }}" type="text/javascript"></script>
19
+	<script src="{{ asset('bundles/muzichcore/js/muzich.js') }}" type="text/javascript"></script>
19 20
   {% block js %}{% endblock %}
21
+  
20 22
 </head>
21 23
 <body>
24
+  
22 25
 	
23 26
   {% include "MuzichUserBundle:Account:topBar.html.twig" %}
24 27
   
@@ -26,6 +29,13 @@
26 29
     {% block main_content %}{% endblock %}
27 30
   </div>
28 31
   
32
+  
33
+  {% for key, flash in app.session.getFlashes() %}
34
+    <div class="{{ key }} message">
35
+      <a class="message-close" href="#" title="fermer"><img alt="close" src="{{ asset('bundles/muzichcore/img/1317386146_cancel.png') }}" /></a>
36
+      <h3>{{ flash }}</h3>
37
+    </div>
38
+  {% endfor %}
29 39
 </body>
30 40
 </html>
31 41
 

+ 1 - 1
src/Muzich/UserBundle/Controller/UserController.php Прегледај датотеку

@@ -38,7 +38,7 @@ class UserController extends Controller
38 38
     $process = $formHandler->process($user);
39 39
     if ($process)
40 40
     {
41
-      $this->container->get('session')->setFlash('fos_user_success', 'change_password.flash.success');
41
+      $this->container->get('session')->setFlash('success', 'Le mot de passe a été changé avec succès.');
42 42
       return new RedirectResponse($this->generateUrl('my_account'));
43 43
     }
44 44
     else

+ 116 - 1
web/bundles/muzichcore/css/main.css Прегледај датотеку

@@ -136,4 +136,119 @@ ul.inline
136 136
 ul.inline li
137 137
 {
138 138
   display: inline;
139
-}
139
+}
140
+
141
+
142
+/* Messages flash */
143
+
144
+.message
145
+{
146
+		-webkit-background-size: 40px 40px;
147
+		-moz-background-size: 40px 40px;
148
+		background-size: 40px 40px;			
149
+		background-image: -webkit-gradient(linear, left top, right bottom,
150
+								color-stop(.25, rgba(255, 255, 255, .05)), color-stop(.25, transparent),
151
+								color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .05)),
152
+								color-stop(.75, rgba(255, 255, 255, .05)), color-stop(.75, transparent),
153
+								to(transparent));
154
+		background-image: -webkit-linear-gradient(135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
155
+							transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
156
+							transparent 75%, transparent);
157
+		background-image: -moz-linear-gradient(135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
158
+							transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
159
+							transparent 75%, transparent);
160
+		background-image: -ms-linear-gradient(135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
161
+							transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
162
+							transparent 75%, transparent);
163
+		background-image: -o-linear-gradient(135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
164
+							transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
165
+							transparent 75%, transparent);
166
+		background-image: linear-gradient(135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
167
+							transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
168
+							transparent 75%, transparent);
169
+								
170
+		 -moz-box-shadow: inset 0 -1px 0 rgba(255,255,255,.4);
171
+		 -webkit-box-shadow: inset 0 -1px 0 rgba(255,255,255,.4);		
172
+		 box-shadow: inset 0 -1px 0 rgba(255,255,255,.4);
173
+		 width: 100%;
174
+		 border: 1px solid;
175
+		 color: #fff;
176
+		 padding: 15px;
177
+		 position: fixed;
178
+		 _position: absolute;
179
+		 text-shadow: 0 1px 0 rgba(0,0,0,.5);
180
+		 -webkit-animation: animate-bg 5s linear infinite;
181
+		 -moz-animation: animate-bg 5s linear infinite;
182
+}
183
+
184
+.info
185
+{
186
+		 background-color: #4ea5cd;
187
+		 border-color: #3b8eb5;
188
+}
189
+
190
+.error
191
+{
192
+		 background-color: #de4343;
193
+		 border-color: #c43d3d;
194
+}
195
+		 
196
+.warning
197
+{
198
+		 background-color: #eaaf51;
199
+		 border-color: #d99a36;
200
+}
201
+
202
+.success
203
+{
204
+		 background-color: #61b832;
205
+		 border-color: #55a12c;
206
+}
207
+
208
+.message h3
209
+{
210
+		 margin: 0 0 5px 0;													 
211
+}
212
+
213
+.message p
214
+{
215
+		 margin: 0;													 
216
+}
217
+
218
+.message a.message-close
219
+{
220
+  float: right;
221
+  margin-top: -14px;
222
+  margin-right: 18px;
223
+  margin-bottom: -11px;
224
+}
225
+
226
+.message a.message-close img:HOVER
227
+{
228
+  width: 52px;
229
+  height: 52px;
230
+  margin-bottom: -13px;
231
+}
232
+
233
+@-webkit-keyframes animate-bg
234
+{
235
+    from {
236
+        background-position: 0 0;
237
+    }
238
+    to {
239
+       background-position: -80px 0;
240
+    }
241
+}
242
+
243
+
244
+@-moz-keyframes animate-bg 
245
+{
246
+    from {
247
+        background-position: 0 0;
248
+    }
249
+    to {
250
+       background-position: -80px 0;
251
+    }
252
+}
253
+
254
+/* Message flash end */

BIN
web/bundles/muzichcore/img/1317386146_cancel.png Прегледај датотеку


+ 29 - 0
web/bundles/muzichcore/js/muzich.js Прегледај датотеку

@@ -0,0 +1,29 @@
1
+
2
+// Messages flashs
3
+
4
+var myMessages = ['info','warning','error','success']; // define the messages types	
5
+
6
+function hideAllMessages()
7
+{
8
+  var messagesHeights = new Array(); // this array will store height for each
9
+	 
10
+ for (i=0; i<myMessages.length; i++)
11
+ {
12
+    messagesHeights[i] = $('.' + myMessages[i]).outerHeight();
13
+    $('.' + myMessages[i]).css('top', -messagesHeights[i]); //move element outside viewport	  
14
+ }
15
+}
16
+
17
+$(document).ready(function(){
18
+		 
19
+  // Initially, hide them all
20
+  hideAllMessages();
21
+
22
+  $('.message').animate({top:"0"}, 500);
23
+
24
+  // When message is clicked, hide it
25
+  $('.message a.message-close').click(function(){			  
26
+    $(this).parent('.message').animate({top: -$(this).outerHeight()-50}, 700);
27
+  });		 
28
+		 
29
+});   

web/bundles/muzichcore/js/jquery-1.6.4.min.js → web/js/jquery-1.6.4.min.js Прегледај датотеку