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.
--- a/candolint/models.py Tue Sep 20 19:47:20 2016 +0800
+++ b/candolint/models.py Fri Oct 07 13:36:44 2016 +0800
user = self.user if self.user is not None else '-'
return '/{}/{}/{}'.format(self.domain, user, self.name)
- owner = self.user if self.user is not None else self.domain
- return '{}/{}'.format(owner, self.name)
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
<div class="uk-container uk-container-center uk-margin-large-top">
- <a href="{{ project.get_url() }}">{{ project.get_title() }}</a>:
- check #{{ check.ordinal }}
+ {% module Template('ui/project-link.html', project=project) %}
+ · check #{{ check.ordinal }}
--- a/templates/project.html Tue Sep 20 19:47:20 2016 +0800
+++ b/templates/project.html Fri Oct 07 13:36:44 2016 +0800
{% extends "base.html" %}
-{% block title %}{{ project.get_title() }}{% end %}
+{% block title %}{{ project.name }}{% end %}
<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
{% set adapter = project.get_adapter() %}
<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
+ <a href="{{ project.get_url() }}">{#
+ #}<span class="uk-link-muted">{#
+ #}{{ project.domain }}/{#
+ #}{% if project.user is not None %}{{ project.user }}/{% end %}{#
--- 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
- project.domain = 'example.com'
- project.name = 'hello-world'
- assert project.get_title() == 'alice/hello-world'
- project.domain = 'hello-world.com'
- project.name = 'central'
- assert project.get_title() == 'hello-world.com/central'
check = Check(started=now)