From e63c730f40614128099db66263c1d4c9564df565 2011-11-19 01:12:52 From: Stefan van der Walt Date: 2011-11-19 01:12:52 Subject: [PATCH] Add info, error and warning message boxes. --- diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 9df4b2e..92c821e 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -174,7 +174,7 @@ class ProjectDashboardHandler(AuthenticatedHandler): 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 @@ class LoginHandler(AuthenticatedHandler): 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): diff --git a/IPython/frontend/html/notebook/static/css/layout.css b/IPython/frontend/html/notebook/static/css/layout.css index b9e0b08..d8bec47 100644 --- a/IPython/frontend/html/notebook/static/css/layout.css +++ b/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 { diff --git a/IPython/frontend/html/notebook/templates/layout.html b/IPython/frontend/html/notebook/templates/layout.html index 9235a6b..ae8a016 100644 --- a/IPython/frontend/html/notebook/templates/layout.html +++ b/IPython/frontend/html/notebook/templates/layout.html @@ -42,9 +42,12 @@
{% if message %} -
- {{message}} -
+ + {% for key in message %} +
+ {{message[key]}} +
+ {% end %} {% end %} {% block content_panel %} diff --git a/IPython/frontend/html/notebook/templates/logout.html b/IPython/frontend/html/notebook/templates/logout.html index e5f47c6..f3c7b53 100644 --- a/IPython/frontend/html/notebook/templates/logout.html +++ b/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 login page. {% end %}