Skip to content
Browse files

Add info, error and warning message boxes.

  • Loading branch information...
1 parent 0a26041 commit e63c730f40614128099db66263c1d4c9564df565 @stefanv committed Nov 18, 2011
View
6 IPython/frontend/html/notebook/handlers.py
@@ -174,7 +174,7 @@ def get(self):
class LoginHandler(AuthenticatedHandler):
- def _render(self, message=''):
+ def _render(self, message=None):
self.render('login.html',
next=self.get_argument('next', default='/'),
read_only=self.read_only,
@@ -190,7 +190,7 @@ def post(self):
if passwd_check(self.application.password, pwd):
self.set_secure_cookie('username', str(uuid.uuid4()))
else:
- self._render(message='Invalid password')
+ self._render(message={'error': 'Invalid password'})
return
self.redirect(self.get_argument('next', default='/'))
@@ -200,7 +200,7 @@ class LogoutHandler(AuthenticatedHandler):
def get(self):
self.clear_cookie('username')
- self.render('logout.html')
+ self.render('logout.html', message={'info': 'Successfully logged out.'})
class NewHandler(AuthenticatedHandler):
View
23 IPython/frontend/html/notebook/static/css/layout.css
@@ -102,12 +102,27 @@
box-pack: center;
}
-#message {
- border: 1px solid red;
- background-color: #FFD3D1;
+.message {
+ border-width: 1px;
+ border-style: solid;
text-align: center;
padding: 0.5em;
- margin: 0.5em;
+ margin: 0.5em 0;
+}
+
+.message.error {
+ background-color: #FFD3D1;
+ border-color: red;
+}
+
+.message.warning {
+ background-color: #FFD09E;
+ border-color: orange;
+}
+
+.message.info {
+ background-color: #CBFFBA;
+ border-color: green;
}
#content_panel {
View
9 IPython/frontend/html/notebook/templates/layout.html
@@ -42,9 +42,12 @@
<div id="content_panel">
{% if message %}
- <div id="message">
- {{message}}
- </div>
+
+ {% for key in message %}
+ <div class="message {{key}}">
+ {{message[key]}}
+ </div>
+ {% end %}
{% end %}
{% block content_panel %}
View
2 IPython/frontend/html/notebook/templates/logout.html
@@ -1,5 +1,5 @@
{% extends layout.html %}
{% block content_panel %}
-You've been successfully logged out.
+Proceed to the <a href="/login">login page</a>.
{% end %}

0 comments on commit e63c730

Please sign in to comment.
Something went wrong with that request. Please try again.