Download:
child 242:d1f63a197c74
parent 240:3c02c1240134
241:f5efb98791b5
Anton Shestakov <av6@dwimlabs.net>, Fri, 07 Oct 2016 13:36:44 +0800
viewer: display full project link, but shade domain and user part Also, project title is just project.name.

6 файлов изменено, 12 вставок(+), 22 удалений(-) [+]
candolint/models.py file | annotate | diff | comparison | revisions
templates/check.html file | annotate | diff | comparison | revisions
templates/project.html file | annotate | diff | comparison | revisions
templates/ui/checks.html file | annotate | diff | comparison | revisions
templates/ui/project-link.html file | annotate | diff | comparison | revisions
tests/test_models.py file | annotate | diff | comparison | revisions
--- a/candolint/models.py Tue Sep 20 19:47:20 2016 +0800
+++ b/candolint/models.py Fri Oct 07 13:36:44 2016 +0800
@@ -54,10 +54,6 @@
user = self.user if self.user is not None else '-'
return '/{}/{}/{}'.format(self.domain, user, self.name)
- def get_title(self):
- owner = self.user if self.user is not None else self.domain
- return '{}/{}'.format(owner, self.name)
-
def get_adapter(self):
if self.domain == 'bitbucket.org':
return adapters.BitbucketAdapter(self)
--- a/templates/check.html Tue Sep 20 19:47:20 2016 +0800
+++ b/templates/check.html Fri Oct 07 13:36:44 2016 +0800
@@ -5,8 +5,8 @@
{% block content %}
<div class="uk-container uk-container-center uk-margin-large-top">
<h2>
- <a href="{{ project.get_url() }}">{{ project.get_title() }}</a>:
- check #{{ check.ordinal }}
+ {% module Template('ui/project-link.html', project=project) %}
+ · check #{{ check.ordinal }}
</h2>
<h3>
{% if check.success %}
--- a/templates/project.html Tue Sep 20 19:47:20 2016 +0800
+++ b/templates/project.html Fri Oct 07 13:36:44 2016 +0800
@@ -1,10 +1,10 @@
{% extends "base.html" %}
-{% block title %}{{ project.get_title() }}{% end %}
+{% block title %}{{ project.name }}{% end %}
{% block content %}
<div class="uk-container uk-container-center uk-margin-large-top">
- <h2><a href="{{ project.get_url() }}">{{ project.get_title() }}</a></h2>
+ <h2>{% module Template('ui/project-link.html', project=project) %}</h2>
<img src="{{ project.get_url() }}/status.svg" alt="Lint Status">
{% include ui/codes.html %}
<dl class="uk-description-list-horizontal list-terse">
--- a/templates/ui/checks.html Tue Sep 20 19:47:20 2016 +0800
+++ b/templates/ui/checks.html Fri Oct 07 13:36:44 2016 +0800
@@ -5,7 +5,7 @@
{% set adapter = project.get_adapter() %}
<tr>
<td class="uk-text-right">{% module Badges(check) %}</td>
- <td class="uk-width-1-1 uk-text-break"><a href="{{ project.get_url() }}">{{ project.get_title() }}</a></td>
+ <td class="uk-width-1-1 uk-text-break">{% module Template('ui/project-link.html', project=project) %}</td>
<td><a href="{{ project.get_url() }}/{{ check.ordinal }}">check #{{ check.ordinal }}</a></td>
<td><a href="{{ adapter.get_branch_url(change) }}">{{ change.branch }}</a></td>
<td><a href="{{ adapter.get_commit_url(change) }}">{% if change.rev is not None %}{{ change.rev }}:{% end %}{{ change.node[:12] }}</a></td>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/ui/project-link.html Fri Oct 07 13:36:44 2016 +0800
@@ -0,0 +1,7 @@
+ <a href="{{ project.get_url() }}">{#
+ #}<span class="uk-link-muted">{#
+ #}{{ project.domain }}/{#
+ #}{% if project.user is not None %}{{ project.user }}/{% end %}{#
+ #}</span>{#
+ #}{{ project.name }}{#
+#}</a>
--- a/tests/test_models.py Tue Sep 20 19:47:20 2016 +0800
+++ b/tests/test_models.py Fri Oct 07 13:36:44 2016 +0800
@@ -13,19 +13,6 @@
name='test-models')
-def test_get_title():
- project = Project()
- project.domain = 'example.com'
- project.user = 'alice'
- project.name = 'hello-world'
- assert project.get_title() == 'alice/hello-world'
-
- project.domain = 'hello-world.com'
- project.user = None
- project.name = 'central'
- assert project.get_title() == 'hello-world.com/central'
-
-
def test_duration():
now = datetime.now()
check = Check(started=now)