Use template inheritance.

This commit is contained in:
Stefan van der Walt 2011-11-18 13:17:36 -08:00
parent 15520ba820
commit c4b7ee1a75
4 changed files with 104 additions and 122 deletions

View File

@ -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):

View File

@ -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 File

@ -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 File

@ -1,69 +1,26 @@
<!DOCTYPE HTML>
<html>
{% extends layout.html %}
<head>
<meta charset="utf-8">
{% block title %}
IPython Dashboard
{% end %}
<title>IPython Dashboard</title>
{% block stylesheet %}
<link rel="stylesheet" href="static/css/projectdashboard.css" type="text/css" />
{% end %}
<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">
{% 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 id="notebook_list">
<div id="project_name"><h2>{{project}}</h2></div>
</div>
{% end %}
<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>
{% 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 %}