##// END OF EJS Templates
Add info, error and warning message boxes.
Stefan van der Walt -
Show More
@@ -174,7 +174,7 b' class ProjectDashboardHandler(AuthenticatedHandler):'
174 174
175 175 class LoginHandler(AuthenticatedHandler):
176 176
177 def _render(self, message=''):
177 def _render(self, message=None):
178 178 self.render('login.html',
179 179 next=self.get_argument('next', default='/'),
180 180 read_only=self.read_only,
@@ -190,7 +190,7 b' class LoginHandler(AuthenticatedHandler):'
190 190 if passwd_check(self.application.password, pwd):
191 191 self.set_secure_cookie('username', str(uuid.uuid4()))
192 192 else:
193 self._render(message='Invalid password')
193 self._render(message={'error': 'Invalid password'})
194 194 return
195 195
196 196 self.redirect(self.get_argument('next', default='/'))
@@ -200,7 +200,7 b' class LogoutHandler(AuthenticatedHandler):'
200 200
201 201 def get(self):
202 202 self.clear_cookie('username')
203 self.render('logout.html')
203 self.render('logout.html', message={'info': 'Successfully logged out.'})
204 204
205 205
206 206 class NewHandler(AuthenticatedHandler):
@@ -102,12 +102,27 b''
102 102 box-pack: center;
103 103 }
104 104
105 #message {
106 border: 1px solid red;
107 background-color: #FFD3D1;
105 .message {
106 border-width: 1px;
107 border-style: solid;
108 108 text-align: center;
109 109 padding: 0.5em;
110 margin: 0.5em;
110 margin: 0.5em 0;
111 }
112
113 .message.error {
114 background-color: #FFD3D1;
115 border-color: red;
116 }
117
118 .message.warning {
119 background-color: #FFD09E;
120 border-color: orange;
121 }
122
123 .message.info {
124 background-color: #CBFFBA;
125 border-color: green;
111 126 }
112 127
113 128 #content_panel {
@@ -42,10 +42,13 b''
42 42
43 43 <div id="content_panel">
44 44 {% if message %}
45 <div id="message">
46 {{message}}
45
46 {% for key in message %}
47 <div class="message {{key}}">
48 {{message[key]}}
47 49 </div>
48 50 {% end %}
51 {% end %}
49 52
50 53 {% block content_panel %}
51 54 {% end %}
@@ -1,5 +1,5 b''
1 1 {% extends layout.html %}
2 2
3 3 {% block content_panel %}
4 You've been successfully logged out.
4 Proceed to the <a href="/login">login page</a>.
5 5 {% end %}
General Comments 0
You need to be logged in to leave comments. Login now