From: Stephen Finucane Date: Sat, 25 Jul 2015 12:51:13 +0000 (+0100) Subject: templates/patch: Add check summary panel X-Git-Tag: v1.1.0~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1ccab062f5d49cce438e61ae267a0e8b5d11d2a;p=thirdparty%2Fpatchwork.git templates/patch: Add check summary panel Add a table to display the checks associated with a patch. This includes the requisite styling along with some additional filters. Signed-off-by: Stephen Finucane -- v3: Slight restyling per web UI rework --- diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 96575df7..a5eac2e5 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -244,6 +244,60 @@ table.patchmeta tr th, table.patchmeta tr td { padding-top: 1em; } +/* checks forms */ +/* TODO(stephenfin): Merge this with 'div.patchform' rules */ +.checks { + border: 1px solid gray; + margin: 0.5em 1em; +} + +.checks th { + margin-top: 0em; + margin-left: -0.6em; + margin-right: -0.6em; + padding: 0.3em 0.3em 0.3em 0.6em; + background-color: #0A0A47; + color: white; + font-size: 100%; + font-weight: normal; +} + +.checks td { + border-top: 1px solid gray; + padding: 10px 15px; + padding-left: 0.2em; + margin-top: 0em; +} + +.checks td a { + text-decoration: none; +} + +.checks td a:visited { + color: #786FB4; +} + +.checks a:hover { + text-decoration: underline; +} + +.checks .state { + font-weight: bold; + color: #ddd; +} + +.checks .state.success { + color: #82ca9d; +} + +.checks .state.warning { + color: #ffe59a; +} + +.checks .state.fail { + color: #f7977a; +} + .comment .meta { background: #f0f0f0; padding: 0.3em 0.5em; diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py index f0387278..82c792c7 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 00dc5a64..37a3bebc 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 %} @@ -165,6 +166,37 @@ function toggle_headers(link_id, headers_id) >{{ patch.pull_url }} {% endif %} +{% if patch.checks %} +

Checks

+ + + + + + +{% for check in patch.checks %} + + + + + +{% endfor %} +
ContextCheckDescription
{{ check.context }} + + {{ check.get_state_display }} + + + {% if check.target_url %} + + {% endif %} + {{ check.description }} + {% if check.target_url %} + + {% endif %} +
+{% endif %} + {% for item in patch.commit_message %}

Commit Message

diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py index 26cfc13f..af5e54dd 100644 --- a/patchwork/templatetags/patch.py +++ b/patchwork/templatetags/patch.py @@ -51,3 +51,8 @@ def patch_checks(patch): return mark_safe('%s' % ( ' / '.join(titles), ' '.join([str(counts[state]) for state in required]))) + + +@register.filter(name='state_class') +def state_class(state): + return '-'.join(state.split())