Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use template inheritance.

  • Loading branch information...
commit 233e9c0fc7e6df9e19f43bee09be61fac37ddc7e 1 parent 7ab92dd
@stefanv stefanv authored
View
9 IPython/frontend/html/notebook/handlers.py
@@ -116,7 +116,14 @@ def auth_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):
View
71 IPython/frontend/html/notebook/templates/layout.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+
+<head>
+ <meta charset="utf-8">
+
+ <title>{% block title %}IPython Notebook{% end %}</title>
+
+ <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" />
+ <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" />
+ <link rel="stylesheet" href="static/css/layout.css" type="text/css" />
+ <link rel="stylesheet" href="static/css/base.css" type="text/css"/>
+ {% block stylesheet %}
+ {% end %}
+
+ <meta name="read_only" content="{{read_only}}"/>
+
+</head>
+
+<body>
+
+<div id="header">
+ <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
+ <span id="login_widget" class="hidden">
+ <button id="login">Login</button>
+ </span>
+ {% block header %}
+ {% end %}
+</div>
+
+<div id="header_border"></div>
+
+<div id="main_app">
+
+ <div id="app_hbox">
+
+ <div id="left_panel">
+ {% block left_panel %}
+ {% end %}
+ </div>
+
+ <div id="content_panel">
+ {% if message %}
+ <div id="message">
+ {{message}}
+ </div>
+ {% end %}
+
+ {% block content_panel %}
+ {% end %}
+ </div>
+ <div id="right_panel">
+ {% block right_panel %}
+ {% end %}
+ </div>
+
+ </div>
+
+</div>
+
+<script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
+<script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
+<script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script>
+<script src="static/js/loginmain.js" type="text/javascript" charset="utf-8"></script>
+<script src="static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script>
+{% block script %}
+{% end %}
+
+</body>
+
+</html>
View
69 IPython/frontend/html/notebook/templates/login.html
@@ -1,61 +1,8 @@
-<!DOCTYPE HTML>
-<html>
-
-<head>
- <meta charset="utf-8">
-
- <title>IPython Notebook</title>
-
- <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" />
- <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" />
- <link rel="stylesheet" href="static/css/layout.css" type="text/css" />
- <link rel="stylesheet" href="static/css/base.css" type="text/css" />
-
- <meta name="read_only" content="{{read_only}}"/>
-
-</head>
-
-<body>
-
-<div id="header">
- <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
-</div>
-
-<div id="header_border"></div>
-
-<div id="main_app">
-
- <div id="app_hbox">
-
- <div id="left_panel">
- </div>
-
- <div id="content_panel">
- {% if message %}
- <div id="message">
- {{message}}
- </div>
- {% end %}
-
- <form action="/login?next={{url_escape(next)}}" method="post">
- Password: <input type="password" name="password">
- <input type="submit" value="Sign in" id="signin">
- </form>
- </div>
- <div id="right_panel">
- </div>
-
- </div>
-
-</div>
-
-<script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
-<script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
-<script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script>
-<script src="static/js/loginmain.js" type="text/javascript" charset="utf-8"></script>
-
-</body>
-
-</html>
-
-
+{% extends layout.html %}
+
+{% block content_panel %}
+ <form action="/login?next={{url_escape(next)}}" method="post">
+ Password: <input type="password" name="password">
+ <input type="submit" value="Sign in" id="signin">
+ </form>
+{% end %}
View
85 IPython/frontend/html/notebook/templates/projectdashboard.html
@@ -1,69 +1,26 @@
-<!DOCTYPE HTML>
-<html>
-
-<head>
- <meta charset="utf-8">
-
- <title>IPython Dashboard</title>
-
- <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" />
- <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" />
- <link rel="stylesheet" href="static/css/layout.css" type="text/css" />
- <link rel="stylesheet" href="static/css/base.css" type="text/css" />
- <link rel="stylesheet" href="static/css/projectdashboard.css" type="text/css" />
-
- <meta name="read_only" content="{{read_only}}"/>
-
-</head>
-
-<body data-project={{project}} data-base-project-url={{base_project_url}}
- data-base-kernel-url={{base_kernel_url}}>
-
-<div id="header">
- <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
- <span id="login_widget" class="hidden">
- <button id="login">Login</button>
- </span>
-</div>
-
-<div id="header_border"></div>
-
-<div id="main_app">
-
- <div id="app_hbox">
-
- <div id="left_panel">
+{% extends layout.html %}
+
+{% block title %}
+IPython Dashboard
+{% end %}
+
+{% block stylesheet %}
+ <link rel="stylesheet" href="static/css/projectdashboard.css" type="text/css" />
+{% end %}
+
+{% block content_panel %}
+ <div id="content_toolbar">
+ <span id="drag_info">Drag files onto the list to import notebooks.</span>
+ <span id="notebooks_buttons">
+ <button id="new_notebook">New Notebook</button>
+ </span>
</div>
-
- <div id="content_panel">
- <div id="content_toolbar">
- <span id="drag_info">Drag files onto the list to import notebooks.</span>
- <span id="notebooks_buttons">
- <button id="new_notebook">New Notebook</button>
- </span>
- </div>
- <div id="notebook_list">
- <div id="project_name"><h2>{{project}}</h2></div>
- </div>
-
- </div>
-
- <div id="right_panel">
- </div>
-
+ <div id="notebook_list">
+ <div id="project_name"><h2>{{project}}</h2></div>
</div>
+{% end %}
-</div>
-
-<script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
-<script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
-<script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script>
+{% block script %}
<script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script>
-<script src="static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script>
<script src="static/js/projectdashboardmain.js" type="text/javascript" charset="utf-8"></script>
-
-</body>
-
-</html>
-
-
+{% end %}
Please sign in to comment.
Something went wrong with that request. Please try again.