diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-06-15 13:21:20 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-06-15 13:21:20 +0100 |
commit | 2fe88b678392344d7042d6ebb375d1d6179537ec (patch) | |
tree | 6248e6591aa41bd2d81efbe966e9f4738440bb9d | |
parent | 43a50c8b7da0714e52c2a0506eece440a7cd3930 (diff) | |
download | morph-cache-server-2fe88b678392344d7042d6ebb375d1d6179537ec.tar.gz |
Add basic styling
Taken from the CSS used in Mason.
-rw-r--r-- | morphcacheserver/frontend.py | 14 | ||||
-rw-r--r-- | morphcacheserver/style.css | 129 | ||||
-rw-r--r-- | morphcacheserver/templates/base.tpl | 3 |
3 files changed, 143 insertions, 3 deletions
diff --git a/morphcacheserver/frontend.py b/morphcacheserver/frontend.py index bc21f70..52c9db5 100644 --- a/morphcacheserver/frontend.py +++ b/morphcacheserver/frontend.py @@ -13,7 +13,7 @@ # with this program. If not, see <http://www.gnu.org/licenses/>. -from bottle import Bottle, request, template +from bottle import Bottle, request, static_file, template import math @@ -23,7 +23,7 @@ def make_table(data, heading_ids, heading_titles): table_template = """ <table border="1"> - <tr> + <tr class="headings"> %for title in heading_titles: <td>{{title}}</td> %end @@ -65,13 +65,15 @@ def web_frontend(db): n_artifacts = db.count_artifacts() n_pages = int(math.ceil(n_artifacts / float(page_size))) - content += '<p>Page %i of %i</p>' % (page, n_pages) + content += '<div id="footer">' + content += '<p>Page %i of %i: ' % (page, n_pages) if page > 1: content += '<a href="?page=%i">prev</a>' % (page-1) if page < n_pages: content += ' -- ' if page < n_pages: content += '<a href="?page=%i">next</a>' % (page+1) + content += '</p></div>' return template('morphcacheserver/templates/base', base=content) @@ -81,4 +83,10 @@ def web_frontend(db): return template('morphcacheserver/templates/index') + @app.get('/style.css') + def stylesheet(): + # For heavily-used deployments you should serve static files like a + # .css using a faster web server like Apache, Cherokee, etc. + return static_file('style.css', root='morphcacheserver') + return app diff --git a/morphcacheserver/style.css b/morphcacheserver/style.css new file mode 100644 index 0000000..0a296b9 --- /dev/null +++ b/morphcacheserver/style.css @@ -0,0 +1,129 @@ +/* This stylesheet is taken from Mason. + * + * Original home: http://git.baserock.org/cgi-bin/cgit.cgi/baserock/baserock/definitions.git/tree/extensions/mason/mason-report.sh + */ + +html, body { + margin: 0; + padding: 0; +} +p.branding { + background: black; + color: #fff; + padding: 0.4em; + margin: 0; + font-weight: bold; +} +h1 { + background: #225588; + color: white; + margin: 0; + padding: 0.6em; +} +table { + width: 90%; + margin: 1em auto 6em auto; + border: 1px solid black; + border-spacing: 0; +} +table tr.headings { + background: #555; + color: white; +} +table tr.pass { + background: #aaffaa; +} +table tr.pass:hover { + background: #bbffbb; +} +table tr.fail { + background: #ffaaaa; +} +table tr.fail:hover { + background: #ffbbbb; +} +table tr.nonet { + background: #ffdd99; +} +table tr.nonet:hover { + background: #ffeeaa; +} +table tr.headings th { + font-weight: bold; + text-align: left; + padding: 3px 2px; +} +table td { + padding: 2px; +} +td.result { + font-weight: bold; + text-transform: uppercase; +} +td.result a { + text-decoration: none; +} +td.result a:before { + content: "➫ "; +} +tr.pass td.result a { + color: #252; +} +tr.pass td.result a:hover { + color: #373; +} +tr.fail td.result a { + color: #622; +} +tr.fail td.result a:hover { + color: #933; +} +tr.nonet td.result a { + color: #641; +} +tr.nonet td.result a:hover { + color: #962; +} +td.ref { + font-family: monospace; +} +td.ref a { + color: #333; +} +td.ref a:hover { + color: #555; +} +table tr.pass td, table tr.fail td { + border-top: solid white 1px; +} +p { + margin: 1.3em; +} +code { + padding: 0.3em 0.5em; + background: #eee; + border: 1px solid #bbb; + border-radius: 1em; +} +#footer { + margin: 0; + background: #aaa; + color: #222; + border-top: #888 1px solid; + font-size: 80%; + padding: 0; + position: fixed; + bottom: 0; + width: 100%; + display: table; +} +#footer p { + padding: 1.3em; + display: table-cell; +} +#footer p code { + font-size: 110%; +} +#footer p.about { + text-align: right; +} diff --git a/morphcacheserver/templates/base.tpl b/morphcacheserver/templates/base.tpl index 79e97fe..755ab9d 100644 --- a/morphcacheserver/templates/base.tpl +++ b/morphcacheserver/templates/base.tpl @@ -1,10 +1,13 @@ <html> <head> + <meta charset="UTF-8"> <title>Baserock Cache Server</title> + <link rel='stylesheet' type='text/css' href='/style.css'/> </head> <body> + <p class="branding">Baserock Cache Server</p> {{!base}} </body> |