diff --git a/atst/app.py b/atst/app.py index 76cfa737..259a6539 100644 --- a/atst/app.py +++ b/atst/app.py @@ -1,10 +1,15 @@ import tornado.web from atst.handlers.main import MainHandler from atst.home import home +from tornado.web import url def make_app(**kwargs): app = tornado.web.Application([ - (r"/", MainHandler), + url( r"/", MainHandler, {'page': 'home'}, name='home' ), + url( r"/requests", MainHandler, {'page': 'requests'}, name='requests' ), + url( r"/users", MainHandler, {'page': 'users'}, name='users' ), + url( r"/reports", MainHandler, {'page': 'reports'}, name='reports' ), + url( r"/calculator", MainHandler, {'page': 'calculator'}, name='calculator' ), ], template_path = home.child('templates'), static_path = home.child('static'), diff --git a/atst/handler.py b/atst/handler.py index 9f47aedf..dd151c4c 100644 --- a/atst/handler.py +++ b/atst/handler.py @@ -3,22 +3,24 @@ from webassets import Environment, Bundle import tornado.web from atst.home import home +# module variables used by the handlers + +assets = Environment( + directory = home.child('scss'), + url = '/static') +css = Bundle( + 'atat.scss', + filters = 'scss', + output = '../static/assets/out.css') + +assets.register( 'css', css ) +helpers = { + 'assets': assets +} + class BaseHandler(tornado.web.RequestHandler): def get_template_namespace(self): - assets = Environment( - directory = home.child('scss'), - url = '/static') - css = Bundle( - 'atat.scss', - filters = 'scss', - output = '../static/assets/out.css') - - assets.register( 'css', css ) - helpers = { - 'assets': assets - } - ns = super(BaseHandler, self).get_template_namespace() ns.update(helpers) return ns diff --git a/atst/handlers/main.py b/atst/handlers/main.py index fdde8fc3..10b6780e 100644 --- a/atst/handlers/main.py +++ b/atst/handlers/main.py @@ -1,5 +1,9 @@ from atst.handler import BaseHandler class MainHandler(BaseHandler): + + def initialize(self,page): + self.page = page + def get(self): - self.render("hello.html.to") + self.render( '%s.html.to' % self.page, page = self.page ) diff --git a/templates/calculator.html.to b/templates/calculator.html.to new file mode 100644 index 00000000..6467821a --- /dev/null +++ b/templates/calculator.html.to @@ -0,0 +1,12 @@ +{% extends "base.html.to" %} + +{% block content %} + +
+ +calculator + +
+ +{% end %} + diff --git a/templates/header.html.to b/templates/header.html.to index b9ad64bd..1f60a210 100644 --- a/templates/header.html.to +++ b/templates/header.html.to @@ -10,14 +10,26 @@ - \ No newline at end of file + diff --git a/templates/home.html.to b/templates/home.html.to new file mode 100644 index 00000000..45668d03 --- /dev/null +++ b/templates/home.html.to @@ -0,0 +1,12 @@ +{% extends "base.html.to" %} + +{% block content %} + +
+ +home + +
+ +{% end %} + diff --git a/templates/reports.html.to b/templates/reports.html.to new file mode 100644 index 00000000..ea6b5f80 --- /dev/null +++ b/templates/reports.html.to @@ -0,0 +1,12 @@ +{% extends "base.html.to" %} + +{% block content %} + +
+ +reports + +
+ +{% end %} + diff --git a/templates/requests.html.to b/templates/requests.html.to new file mode 100644 index 00000000..eae9b51c --- /dev/null +++ b/templates/requests.html.to @@ -0,0 +1,12 @@ +{% extends "base.html.to" %} + +{% block content %} + +
+ +jedi requests + +
+ +{% end %} + diff --git a/templates/users.html.to b/templates/users.html.to new file mode 100644 index 00000000..1e5add96 --- /dev/null +++ b/templates/users.html.to @@ -0,0 +1,12 @@ +{% extends "base.html.to" %} + +{% block content %} + +
+ +users + +
+ +{% end %} +