Add all the templates and the routes
This commit is contained in:
parent
5007a246fb
commit
b9de54d211
@ -1,10 +1,15 @@
|
|||||||
import tornado.web
|
import tornado.web
|
||||||
from atst.handlers.main import MainHandler
|
from atst.handlers.main import MainHandler
|
||||||
from atst.home import home
|
from atst.home import home
|
||||||
|
from tornado.web import url
|
||||||
|
|
||||||
def make_app(**kwargs):
|
def make_app(**kwargs):
|
||||||
app = tornado.web.Application([
|
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'),
|
template_path = home.child('templates'),
|
||||||
static_path = home.child('static'),
|
static_path = home.child('static'),
|
||||||
|
@ -3,9 +3,8 @@ from webassets import Environment, Bundle
|
|||||||
import tornado.web
|
import tornado.web
|
||||||
from atst.home import home
|
from atst.home import home
|
||||||
|
|
||||||
class BaseHandler(tornado.web.RequestHandler):
|
# module variables used by the handlers
|
||||||
|
|
||||||
def get_template_namespace(self):
|
|
||||||
assets = Environment(
|
assets = Environment(
|
||||||
directory = home.child('scss'),
|
directory = home.child('scss'),
|
||||||
url = '/static')
|
url = '/static')
|
||||||
@ -19,6 +18,9 @@ class BaseHandler(tornado.web.RequestHandler):
|
|||||||
'assets': assets
|
'assets': assets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BaseHandler(tornado.web.RequestHandler):
|
||||||
|
|
||||||
|
def get_template_namespace(self):
|
||||||
ns = super(BaseHandler, self).get_template_namespace()
|
ns = super(BaseHandler, self).get_template_namespace()
|
||||||
ns.update(helpers)
|
ns.update(helpers)
|
||||||
return ns
|
return ns
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
from atst.handler import BaseHandler
|
from atst.handler import BaseHandler
|
||||||
|
|
||||||
class MainHandler(BaseHandler):
|
class MainHandler(BaseHandler):
|
||||||
|
|
||||||
|
def initialize(self,page):
|
||||||
|
self.page = page
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
self.render("hello.html.to")
|
self.render( '%s.html.to' % self.page, page = self.page )
|
||||||
|
12
templates/calculator.html.to
Normal file
12
templates/calculator.html.to
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html.to" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<main class="usa-grid usa-section usa-content usa-layout-docs" id="main-content">
|
||||||
|
|
||||||
|
calculator
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{% end %}
|
||||||
|
|
@ -10,11 +10,23 @@
|
|||||||
|
|
||||||
<nav role="navigation" class="usa-nav">
|
<nav role="navigation" class="usa-nav">
|
||||||
<ul class="usa-nav-primary usa-accordion">
|
<ul class="usa-nav-primary usa-accordion">
|
||||||
<li><a class="usa-nav-link" href="#"><span>Home</span></a></li>
|
{% for item in [
|
||||||
<li><a class="usa-nav-link usa-current" href="#"><span>JEDI Requests</span></a></li>
|
['home', 'Home'],
|
||||||
<li><a class="usa-nav-link" href="#"><span>Users</span></a></li>
|
['requests', 'JEDI Requests'],
|
||||||
<li><a class="usa-nav-link" href="#"><span>Reports</span></a></li>
|
['users', 'Users' ],
|
||||||
<li><a class="usa-nav-link" href="#"><span>Usage Calculator</span></a></li>
|
['reports', 'Reports' ],
|
||||||
|
['calculator','Usage Calculator'],
|
||||||
|
]
|
||||||
|
%}
|
||||||
|
<li>
|
||||||
|
{% if item[0]==page %}
|
||||||
|
<a class="usa-nav-link usa-current" href='{{ reverse_url(item[0]) }}'><span>{{ item[1] }}</span></a>
|
||||||
|
{% else %}
|
||||||
|
<a class="usa-nav-link" href='{{ reverse_url(item[0]) }}'><span>{{ item[1] }}</span></a>
|
||||||
|
{% end %}
|
||||||
|
</li>
|
||||||
|
{% end %}
|
||||||
|
|
||||||
<li>Tech Lead</li>
|
<li>Tech Lead</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
12
templates/home.html.to
Normal file
12
templates/home.html.to
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html.to" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<main class="usa-grid usa-section usa-content usa-layout-docs" id="main-content">
|
||||||
|
|
||||||
|
home
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{% end %}
|
||||||
|
|
12
templates/reports.html.to
Normal file
12
templates/reports.html.to
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html.to" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<main class="usa-grid usa-section usa-content usa-layout-docs" id="main-content">
|
||||||
|
|
||||||
|
reports
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{% end %}
|
||||||
|
|
12
templates/requests.html.to
Normal file
12
templates/requests.html.to
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html.to" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<main class="usa-grid usa-section usa-content usa-layout-docs" id="main-content">
|
||||||
|
|
||||||
|
jedi requests
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{% end %}
|
||||||
|
|
12
templates/users.html.to
Normal file
12
templates/users.html.to
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html.to" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<main class="usa-grid usa-section usa-content usa-layout-docs" id="main-content">
|
||||||
|
|
||||||
|
users
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{% end %}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user