Add a table to display the statuses associated with a patch. This includes the requisite styling along with some additional filters.
Signed-off-by: Stephen Finucane <[email protected]> --- htdocs/css/style.css | 44 ++++++++++++++++++++++++++++++++ patchwork/settings/base.py | 1 + patchwork/templates/patchwork/patch.html | 25 ++++++++++++++++++ patchwork/templatetags/patch.py | 5 ++++ 4 files changed, 75 insertions(+) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index e5bbc75..5f5ac1a 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -285,6 +285,50 @@ table.patchmeta tr th, table.patchmeta tr td { padding-top: 1em; } +.statuses { + border: 1px solid gray; + margin: 0.5em 1em; +} + +.statuses th { + background: #786fb4; + color: white; +} + +.statuses td { + border-top: 1px solid gray; + padding: 10px 15px; +} + +.statuses td a { + text-decoration: none; +} + +.statuses td a:visited { + color: #786FB4; +} + +.statuses a:hover { + text-decoration: underline; +} + +.statuses .state { + font-weight: bold; + color: #ddd; +} + +.statuses .state.success { + color: #82ca9d; +} + +.statuses .state.warning { + color: #ffe59a; +} + +.statuses .state.fail { + color: #f7977a; +} + .comment .meta { background: #f0f0f0; } diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py index 5b40bcb..245089a 100644 --- a/patchwork/settings/base.py +++ b/patchwork/settings/base.py @@ -19,6 +19,7 @@ ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', + 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', diff --git a/patchwork/templates/patchwork/patch.html b/patchwork/templates/patchwork/patch.html index f18ee3b..055f6ca 100644 --- a/patchwork/templates/patchwork/patch.html +++ b/patchwork/templates/patchwork/patch.html @@ -1,5 +1,6 @@ {% extends "base.html" %} +{% load humanize %} {% load syntax %} {% load person %} {% load patch %} @@ -176,6 +177,30 @@ function toggle_headers(link_id, headers_id) >{{ patch.pull_url }}</a> {% endif %} +{% if patch.statuses %} +<h2>Statuses</h2> +<table class="statuses"> +<tr> + <th>Context</th> + <th>Description</th> + <th>Status</th> +</tr> +{% for status in patch.statuses %} +<tr> + <td>{{ status.context }}</td> + <td> + {% if status.target_url %}<a href="{{ status.target_url }}">{% endif %} + {{ status.description }}</td> + {% if status.target_url %}</a>{% endif %} + <td><span title="Updated {{ status.date|naturaltime }}" + class="state {{ status.get_state_display }}"> + {{ status.get_state_display }}</span> + </td> +</tr> +{% endfor %} +</table> +{% endif %} + <h2>Comments</h2> {% for comment in patch.comments %} <div class="comment"> diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py index fc47a31..ae1a5e5 100644 --- a/patchwork/templatetags/patch.py +++ b/patchwork/templatetags/patch.py @@ -89,3 +89,8 @@ def patch_statuses(patch): return mark_safe('<span title="%s">%s</span>' % ( ' / '.join(titles), ' '.join([str(counts[state]) for state in required]))) + + [email protected](name='state_class') +def state_class(state): + return '-'.join(state.split()) -- 2.0.0 _______________________________________________ Patchwork mailing list [email protected] https://lists.ozlabs.org/listinfo/patchwork
