From 233e9c0fc7e6df9e19f43bee09be61fac37ddc7e 2011-11-18 21:17:36 From: Stefan van der Walt Date: 2011-11-18 21:17:36 Subject: [PATCH] Use template inheritance. --- diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 7822118..43d86b7 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -116,7 +116,14 @@ def authenticate_unless_readonly(f, self, *args, **kwargs): # Top-level handlers #----------------------------------------------------------------------------- -class AuthenticatedHandler(web.RequestHandler): +class RequestHandler(web.RequestHandler): + """RequestHandler with default variable setting.""" + + def render(*args, **kwargs): + kwargs.setdefault('message', '') + return web.RequestHandler.render(*args, **kwargs) + +class AuthenticatedHandler(RequestHandler): """A RequestHandler with an authenticated user.""" def get_current_user(self): diff --git a/IPython/frontend/html/notebook/templates/layout.html b/IPython/frontend/html/notebook/templates/layout.html new file mode 100644 index 0000000..db4603f --- /dev/null +++ b/IPython/frontend/html/notebook/templates/layout.html @@ -0,0 +1,71 @@ + + + + + + + {% block title %}IPython Notebook{% end %} + + + + + + {% block stylesheet %} + {% end %} + + + + + + + + + +
+ +
+ +
+ +
+ {% block left_panel %} + {% end %} +
+ +
+ {% if message %} +
+ {{message}} +
+ {% end %} + + {% block content_panel %} + {% end %} +
+
+ {% block right_panel %} + {% end %} +
+ +
+ +
+ + + + + + +{% block script %} +{% end %} + + + + diff --git a/IPython/frontend/html/notebook/templates/login.html b/IPython/frontend/html/notebook/templates/login.html index b719c5b..08b71a6 100644 --- a/IPython/frontend/html/notebook/templates/login.html +++ b/IPython/frontend/html/notebook/templates/login.html @@ -1,61 +1,8 @@ - - - - - - - IPython Notebook - - - - - - - - - - - - - - -
- -
- -
- -
-
- -
- {% if message %} -
- {{message}} -
- {% end %} - -
- Password: - -
-
-
-
- -
- -
- - - - - - - - - - - +{% extends layout.html %} + +{% block content_panel %} +
+ Password: + +
+{% end %} diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 386e261..9caf872 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -1,69 +1,26 @@ - - - - - - - IPython Dashboard - - - - - - - - - - - - - - - -
- -
- -
- -
+{% extends layout.html %} + +{% block title %} +IPython Dashboard +{% end %} + +{% block stylesheet %} + +{% end %} + +{% block content_panel %} +
+ Drag files onto the list to import notebooks. + + +
- -
-
- Drag files onto the list to import notebooks. - - - -
-
-

{{project}}

-
- -
- -
-
- +
+

{{project}}

+{% end %} -
- - - - +{% block script %} - - - - - - - +{% end %}