--- a/candolint/models.py Wed Jun 15 22:20:45 2016 +0800
+++ b/candolint/models.py Wed Jun 15 23:49:22 2016 +0800
(('domain', 'user', 'name'), True),
+ def get_url(self, request=None):
+ if request is not None:
+ base = '{}://{}'.format(request.protocol, request.host)
+ return base + self.get_url()
+ user = self.user if self.user is not None else '-'
+ return '/{}/{}/{}'.format(self.domain, user, self.name)
(('ordinal', 'project'), True),
+ def get_url(self, request=None):
+ return '{}/{}'.format(self.project.get_url(request), self.ordinal)
--- a/templates/check.html Wed Jun 15 22:20:45 2016 +0800
+++ b/templates/check.html Wed Jun 15 23:49:22 2016 +0800
<div class="uk-container uk-container-center uk-margin-large-top">
- <h2>{{ project.name }}: check #{{ check.ordinal }}</h2>
+ <a href="{{ project.get_url() }}">{{ project.name }}</a>:
+ check #{{ check.ordinal }}
{{ locale.translate('{} error', '{} errors', check.errors).format(check.errors) }},
--- a/templates/index.html Wed Jun 15 22:20:45 2016 +0800
+++ b/templates/index.html Wed Jun 15 23:49:22 2016 +0800
{% set change = check.change %}
<td>{% module Badges(check) %}</td>
- <a href="/{{ project.domain }}/{{ project.user or '-' }}/{{ project.name }}/{{ check.ordinal }}">
- <a href="/{{ project.domain }}/{{ project.user or '-' }}/{{ project.name }}">
+ <td><a href="{{ check.get_url() }}">#{{ check.ordinal }}</a></td>
+ <td><a href="{{ project.get_url() }}">{{ project.name }}</a></td>
<td>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</td>
<td>{% module Time(check.started) %}</td>
<td>{% module Time(check.finished) %}</td>
--- a/templates/project.html Wed Jun 15 22:20:45 2016 +0800
+++ b/templates/project.html Wed Jun 15 23:49:22 2016 +0800
{% set change = check.change %}
<td>{% module Badges(check) %}</td>
- <a href="/{{ project.domain }}/{{ project.user or '-' }}/{{ project.name }}/{{ check.ordinal }}">
+ <td><a href="{{ check.get_url() }}">#{{ check.ordinal }}</a></td>
<td>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</td>
<div>{{ change.message }}</div>