Merge pull request #6 from dod-ccpo/nav-menu
Main navigation bar and routes.
This commit is contained in:
commit
cfb01b5061
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ static/fonts/*
|
||||
.webassets-cache
|
||||
scss/assets
|
||||
.pytest_cache/
|
||||
.venv/
|
||||
|
41
app.py
41
app.py
@ -1,42 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from atst.app import make_app
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
import os
|
||||
from webassets import Environment, Bundle
|
||||
|
||||
# Set up assets.
|
||||
static_path = os.path.join(os.path.dirname(__file__), "static")
|
||||
scss_path = os.path.join(os.path.dirname(__file__), "scss")
|
||||
assets = Environment(directory=scss_path, url='/static')
|
||||
css = Bundle('atat.scss', filters='scss', output='../static/assets/out.css')
|
||||
assets.register('css', css)
|
||||
helpers = {
|
||||
'assets': assets
|
||||
}
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
|
||||
def get_template_namespace(self):
|
||||
ns = super(MainHandler, self).get_template_namespace()
|
||||
ns.update(helpers)
|
||||
return ns
|
||||
|
||||
def get(self):
|
||||
self.render("hello.html.to")
|
||||
|
||||
def make_app():
|
||||
app = tornado.web.Application([
|
||||
(r"/", MainHandler),
|
||||
],
|
||||
debug=os.getenv('DEBUG',False),
|
||||
template_path=os.path.join(os.path.dirname(__file__), "templates"),
|
||||
static_path=static_path
|
||||
)
|
||||
return app
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = make_app()
|
||||
app.listen(8888)
|
||||
print("Listening on http://localhost:8888")
|
||||
app = make_app(debug=os.getenv('DEBUG',False))
|
||||
port = 8888
|
||||
app.listen(port)
|
||||
print("Listening on http://localhost:%i" % port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
0
atst/__init__.py
Normal file
0
atst/__init__.py
Normal file
18
atst/app.py
Normal file
18
atst/app.py
Normal file
@ -0,0 +1,18 @@
|
||||
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([
|
||||
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'),
|
||||
**kwargs
|
||||
)
|
||||
return app
|
26
atst/handler.py
Normal file
26
atst/handler.py
Normal file
@ -0,0 +1,26 @@
|
||||
import os
|
||||
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):
|
||||
ns = super(BaseHandler, self).get_template_namespace()
|
||||
ns.update(helpers)
|
||||
return ns
|
0
atst/handlers/__init__.py
Normal file
0
atst/handlers/__init__.py
Normal file
9
atst/handlers/main.py
Normal file
9
atst/handlers/main.py
Normal file
@ -0,0 +1,9 @@
|
||||
from atst.handler import BaseHandler
|
||||
|
||||
class MainHandler(BaseHandler):
|
||||
|
||||
def initialize(self,page):
|
||||
self.page = page
|
||||
|
||||
def get(self):
|
||||
self.render( '%s.html.to' % self.page, page = self.page )
|
3
atst/home.py
Normal file
3
atst/home.py
Normal file
@ -0,0 +1,3 @@
|
||||
from unipath import Path
|
||||
|
||||
home = Path( __file__ ).parent.parent
|
@ -2,3 +2,4 @@ tornado==5.0.2
|
||||
webassets==0.12.1
|
||||
pytest==3.6.0
|
||||
pytest-tornado==0.5.0
|
||||
Unipath==1.1
|
||||
|
@ -1,2 +1,2 @@
|
||||
@import 'variables.scss';
|
||||
@import '../node_modules/uswds/src/stylesheets/uswds.scss';
|
||||
@import 'variables.scss';
|
@ -1 +0,0 @@
|
||||
|
BIN
static/img/foo.png
Normal file
BIN
static/img/foo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 357 KiB |
BIN
static/img/logo.png
Normal file
BIN
static/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -9,20 +9,18 @@
|
||||
{% end %}
|
||||
</head>
|
||||
<body>
|
||||
<header class="usa-header usa-header-basic" role="banner">
|
||||
<div class="usa-nav-container">
|
||||
<div class="usa-navbar">
|
||||
<div class="usa-logo" id="basic-logo">
|
||||
<em class="usa-logo-text"><a href="/" title="Home" aria-label="Home">Jedi</a></em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% include 'header.html.to' %}
|
||||
|
||||
<div class='usa-grid'>
|
||||
{% block content %}
|
||||
these are not the droids you are looking for
|
||||
{% end %}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% include 'footer.html.to' %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
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 %}
|
||||
|
46
templates/footer.html.to
Normal file
46
templates/footer.html.to
Normal file
@ -0,0 +1,46 @@
|
||||
<footer class="usa-footer usa-footer-slim" role="contentinfo">
|
||||
<div class="usa-grid usa-footer-return-to-top">
|
||||
<a href="#">Return to top</a>
|
||||
</div>
|
||||
<div class="usa-footer-primary-section">
|
||||
<div class="usa-grid">
|
||||
<nav class="usa-footer-nav usa-width-two-thirds">
|
||||
<ul class="usa-unstyled-list">
|
||||
<li class="usa-width-one-fourth usa-footer-primary-content">
|
||||
<a class="usa-footer-primary-link" href="javascript:void(0);">JEDI Requests</a>
|
||||
</li>
|
||||
<li class="usa-width-one-fourth usa-footer-primary-content">
|
||||
<a class="usa-footer-primary-link" href="javascript:void(0);">Users</a>
|
||||
</li>
|
||||
<li class="usa-width-one-fourth usa-footer-primary-content">
|
||||
<a class="usa-footer-primary-link" href="javascript:void(0);">Reports</a>
|
||||
</li>
|
||||
<li class="usa-width-one-fourth usa-footer-primary-content">
|
||||
<a class="usa-footer-primary-link" href="javascript:void(0);">Usage Calculator</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<address>
|
||||
<div class="usa-width-one-third">
|
||||
<div class="usa-footer-primary-content usa-footer-contact_info">
|
||||
<p>
|
||||
<a href="tel:1-800-555-5555">(800) CALL-GOVT</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="usa-footer-primary-content usa-footer-contact_info">
|
||||
<p><a href="mailto:info@dds.mil">info@dds.mil</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="usa-footer-secondary_section">
|
||||
<div class="usa-grid">
|
||||
<div class="usa-footer-logo">
|
||||
<img class="usa-footer-slim-logo-img" src="/static/img/logo.png" alt="Defense Digital Service Logo">
|
||||
<h3 class="usa-footer-slim-logo-heading">Defense Digital Service</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
35
templates/header.html.to
Normal file
35
templates/header.html.to
Normal file
@ -0,0 +1,35 @@
|
||||
<header class="usa-header usa-header-basic" role="banner">
|
||||
<div class="usa-nav-container">
|
||||
<div class="usa-navbar">
|
||||
<div class="usa-logo" id="basic-logo">
|
||||
<em class="usa-logo-text">
|
||||
<a href="/" title="Home" aria-label="Home">AT-AT</a>
|
||||
</em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav role="navigation" class="usa-nav">
|
||||
<ul class="usa-nav-primary usa-accordion">
|
||||
{% for item in [
|
||||
['home', 'Home'],
|
||||
['requests', 'JEDI Requests'],
|
||||
['users', 'Users' ],
|
||||
['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>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
</header>
|
@ -1,11 +0,0 @@
|
||||
{% extends "base.html.to" %}
|
||||
|
||||
{% block title %}
|
||||
hello
|
||||
{% end %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Hello!</h1>
|
||||
is it me you're looking for?
|
||||
{% end %}
|
||||
|
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 %}
|
||||
|
31
templates/nav-side.html.to
Normal file
31
templates/nav-side.html.to
Normal file
@ -0,0 +1,31 @@
|
||||
<aside class="usa-width-one-fourth usa-layout-docs-sidenav">
|
||||
<ul class="usa-sidenav-list">
|
||||
<li>
|
||||
<a class="usa-current" href="#details-of-use">1. Details of Use</a>
|
||||
<ul class="usa-sidenav-sub_list">
|
||||
<li>
|
||||
<a href="#application-details">Application Details</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#application-computation">Computation</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#application-storage">Storage</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#">2. Organizational Info</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">3. Funding/Contracting</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">4. Readiness Survey</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">5. Review & Submit</a>
|
||||
</li>
|
||||
</ul>
|
||||
</aside>
|
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 %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
import tornado.web
|
||||
from app import make_app
|
||||
from atst.app import make_app
|
||||
|
||||
@pytest.fixture
|
||||
def app():
|
||||
|
Loading…
x
Reference in New Issue
Block a user