Download:
child 13:448ea1a0274c
parent 11:86067e7580c6
12:2ea3583bd611
Anton Shestakov <av6@dwimlabs.net>, Tue, 14 Jun 2016 13:24:35 +0800
viewer: project view

5 файлов изменено, 63 вставок(+), 1 удалений(-) [+]
static/main.css file | annotate | diff | comparison | revisions
templates/base.html file | annotate | diff | comparison | revisions
templates/index.html file | annotate | diff | comparison | revisions
templates/project.html file | annotate | diff | comparison | revisions
viewer.py file | annotate | diff | comparison | revisions
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/static/main.css Tue Jun 14 13:24:35 2016 +0800
@@ -0,0 +1,8 @@
+@media (min-width: 768px) {
+ .list-terse > dt {
+ width: 120px;
+ }
+ .list-terse > dd {
+ margin-left: 130px;
+ }
+}
--- a/templates/base.html Mon Jun 13 23:38:17 2016 +0800
+++ b/templates/base.html Tue Jun 14 13:24:35 2016 +0800
@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% end %}{% block extra-title %} - Cat and Owl's online linter{% end %}</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.3/css/uikit.almost-flat.min.css" integrity="sha384-5bOKVP1JAsV2lpzCrvNxDsgBg/FrwwHfDcgmtE7quy/iY+stYq7ORPYbkzJYffwS" crossorigin="anonymous">
+ <link rel="stylesheet" href="/static/main.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" integrity="sha384-rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.3/js/uikit.min.js" integrity="sha384-6OYggLGXv4OPaVsh9O/0baGeEYFu1r1FE3+sNtPeDk6JofnNNZb2sHKzUa7wum04" crossorigin="anonymous"></script>
</head>
--- a/templates/index.html Mon Jun 13 23:38:17 2016 +0800
+++ b/templates/index.html Tue Jun 14 13:24:35 2016 +0800
@@ -13,7 +13,11 @@
<tr>
<td>{{ check.errors }} error(s), {{ check.warnings }} warning(s)</td>
<td>#{{ check.ordinal }}</td>
- <td>{{ project.name }}</td>
+ <td>
+ <a href="/{{ project.domain }}/{{ project.user or '-' }}/{{ project.name }}">
+ {{ project.name }}
+ </a>
+ </td>
<td>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</td>
<td>{{ check.started }}</td>
<td>{{ check.finished }}</td>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/project.html Tue Jun 14 13:24:35 2016 +0800
@@ -0,0 +1,34 @@
+{% extends "base.html" %}
+
+{% block title %}{{ project.name }}{% end %}
+
+{% block content %}
+ <div class="uk-container uk-container-center uk-margin-large-top">
+ <h2>{{ project.name }}</h2>
+ <dl class="uk-description-list-horizontal list-terse">
+ <dt>Last check:</dt>
+ <dd>{{ checks[0].finished }}</dd>
+ <dt>Clone URL:</dt>
+ <dd>{{ project.url }}</dd>
+ </dl>
+ <table class="uk-table uk-table-middle">
+ <tbody>
+ {% for check in checks %}
+ {% set change = check.change %}
+ <tr>
+ <td>{{ check.errors }} error(s), {{ check.warnings }} warning(s)</td>
+ <td>#{{ check.ordinal }}</td>
+ <td>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</td>
+ <td>
+ <div>{{ change.message }}</div>
+ <div>{{ change.author }}, <time>{{ change.date }}</time></div>
+ </td>
+ <td>{{ check.started }}</td>
+ <td>{{ check.finished }}</td>
+ <td>{{ check.finished - check.started }}</td>
+ </tr>
+ {% end %}
+ </tbody>
+ </table>
+ </div>
+{% end %}
--- a/viewer.py Mon Jun 13 23:38:17 2016 +0800
+++ b/viewer.py Tue Jun 14 13:24:35 2016 +0800
@@ -39,10 +39,25 @@
self.render('index.html', checks=checks)
+class ProjectHandler(BaseHandler):
+ def get(self, domain, user, name):
+ project = Project.select().where(
+ Project.domain == domain,
+ Project.user == (user if user != '-' else None),
+ Project.name == name).get()
+ checks = (Check
+ .select(Check, Change)
+ .join(Change)
+ .where(Check.project == project)
+ .limit(10))
+ self.render('project.html', project=project, checks=checks)
+
+
class CandolintViewer(Application):
def __init__(self):
handlers = [
URLSpec(r'/', IndexHandler),
+ URLSpec(r'/([.a-z0-9_-]+)/([^/]+)/([^/]+)', ProjectHandler),
]
settings = dict(
static_path=rel('static'),