summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorraylu <raylu@gridium.com>2013-10-22 22:22:26 -0700
committerraylu <raylu@gridium.com>2013-10-22 22:22:26 -0700
commit29d0528ec6ff9cf61af3bab2feb71dcb3625240a (patch)
tree74e0b143e576fee14a217f74e8cf414b70e75c40 /web
parent0dea8f430e4905da98d7009bdf111e0965fedd22 (diff)
downloadykill-29d0528ec6ff9cf61af3bab2feb71dcb3625240a.tar.xz
most expensive kills on homepage
Diffstat (limited to 'web')
-rw-r--r--web/api.py6
-rw-r--r--web/static/css/base.ccss39
-rw-r--r--web/static/css/home.ccss8
-rw-r--r--web/static/js/home.js17
-rw-r--r--web/templates/base.html15
-rw-r--r--web/templates/home.html15
6 files changed, 84 insertions, 16 deletions
diff --git a/web/api.py b/web/api.py
index 5f21441..70c0aff 100644
--- a/web/api.py
+++ b/web/api.py
@@ -39,12 +39,18 @@ class KillHandler(APIHandler):
kill = db.queries.kill(kill_id)
self.respond_json(kill)
+class TopCostHandler(APIHandler):
+ def get(self):
+ kills = db.queries.top_cost()
+ self.respond_json(kills)
+
def start():
tornado.web.Application(
handlers=[
(r'/search', SearchHandler),
(r'/(alliance|corporation|character)/(.+)', KillListHandler),
(r'/kill/(.+)', KillHandler),
+ (r'/top/cost', TopCostHandler),
],
debug=config.debug,
).listen(config.api_port)
diff --git a/web/static/css/base.ccss b/web/static/css/base.ccss
index 1142021..a7e130b 100644
--- a/web/static/css/base.ccss
+++ b/web/static/css/base.ccss
@@ -16,11 +16,14 @@ a:
text-decoration: none
color: #38c
-form:
- input:
- background: #fff
- border: 1px solid #cdd
- padding: 5px 10px
+form input:
+ background: #111
+ border: 1px solid #444
+ padding: 3px 10px
+ color: #ccc
+ height: 2em
+ vertical-align: middle
+ margin: 0
table:
border-collapse: collapse
@@ -33,7 +36,31 @@ table:
.clear:
clear: both
+#topbar:
+ width: 900px
+ margin: 50px auto 2px
+
+ h1:
+ display: inline-block
+ margin: 0 40px 0 10px
+
+ #nav:
+ display: inline-block
+
+ a:
+ display: inline-block
+ background-color: #111
+ margin: 0 2px
+ padding: 4px
+
+ form:
+ display: inline-block
+ float: right
+
+ input[type="search"]:
+ margin-right: 5px
+
#wrapper:
width: 900px
- margin: 50px auto
+ margin: 0 auto 50px
background: #111
diff --git a/web/static/css/home.ccss b/web/static/css/home.ccss
new file mode 100644
index 0000000..ecb8d24
--- /dev/null
+++ b/web/static/css/home.ccss
@@ -0,0 +1,8 @@
+#wrapper:
+ padding: 20px
+
+#expensive:
+ margin: 0 auto
+
+ caption, tr:nth-child(odd):
+ background-color: #181818
diff --git a/web/static/js/home.js b/web/static/js/home.js
new file mode 100644
index 0000000..8bbe943
--- /dev/null
+++ b/web/static/js/home.js
@@ -0,0 +1,17 @@
+window.addEvent('domready', function() {
+ var table = $('expensive');
+ ykill.api('/top/cost', function(kills) {
+ kills.each(function(kill) {
+ table.grab(new Element('tr').adopt(
+ new Element('td').grab(ykill.portrait(kill['ship_type_id'], kill['ship_name'], 'type', '_32.png')),
+ new Element('td', {'html': kill['ship_name']}),
+ new Element('td').grab(
+ new Element('a', {
+ 'href': '/kill/' + kill['kill_id'],
+ 'html': ykill.format_isk(kill['cost'] / (100 * 1000 * 1000 * 1000))
+ })
+ )
+ ));
+ });
+ });
+});
diff --git a/web/templates/base.html b/web/templates/base.html
index 5573839..9f3e0de 100644
--- a/web/templates/base.html
+++ b/web/templates/base.html
@@ -15,13 +15,16 @@
{% block js %}{% end %}
</head>
<body>
- <div id="wrapper">
- <div id="topbar">
- <div id="title"></div>
- <div id="nav">
- </div>
+ <div id="topbar">
+ <h1><a href="/">u r ded</a></h1>
+ <div id="nav">
</div>
-
+ <form method="get" action="/search">
+ <input type="search" name="q">
+ <input type="submit" value="search">
+ </form>
+ </div>
+ <div id="wrapper">
{% block main %}{% end %}
</div>
</body>
diff --git a/web/templates/home.html b/web/templates/home.html
index 34fe371..07ec4f2 100644
--- a/web/templates/home.html
+++ b/web/templates/home.html
@@ -1,8 +1,15 @@
{% extends "base.html" %}
+{% block js %}
+ <script src="/static/js/home.js"></script>
+{% end %}
+
+{% block css %}
+ <link rel="stylesheet" type="text/css" href="/css/home.css" />
+{% end %}
+
{% block main %}
-<form method="get" action="/search">
- <input type="text" name="q">
- <input type="submit">
-</form>
+<table id="expensive">
+ <caption>most expensive kills</caption>
+</table>
{% end %}