Skip to content

Commit

Permalink
Add info, error and warning message boxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Nov 19, 2011
1 parent 0a26041 commit e63c730
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
6 changes: 3 additions & 3 deletions IPython/frontend/html/notebook/handlers.py
Expand Up @@ -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,
Expand All @@ -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='/'))
Expand All @@ -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):
Expand Down
23 changes: 19 additions & 4 deletions IPython/frontend/html/notebook/static/css/layout.css
Expand Up @@ -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 {
Expand Down
9 changes: 6 additions & 3 deletions IPython/frontend/html/notebook/templates/layout.html
Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion 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.