summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest
diff options
context:
space:
mode:
authorTomas Vondra2015-02-21 18:05:45 +0000
committerMagnus Hagander2015-02-21 18:05:45 +0000
commit9ae46a51835aab69cf9a6ca153b5b9ec6673f64b (patch)
tree8430e30f5a7c859145422b55a2bf10cc91c0d442 /pgcommitfest/commitfest
parenta5300fa4802749be5d43f3183f636c70342538cc (diff)
Use different types of labels for different patch statuses
This highlights the different statuses better in a long list.
Diffstat (limited to 'pgcommitfest/commitfest')
-rw-r--r--pgcommitfest/commitfest/models.py8
-rw-r--r--pgcommitfest/commitfest/templates/commitfest.html2
-rw-r--r--pgcommitfest/commitfest/templatetags/commitfest.py6
3 files changed, 15 insertions, 1 deletions
diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py
index 0aa66dc..6035027 100644
--- a/pgcommitfest/commitfest/models.py
+++ b/pgcommitfest/commitfest/models.py
@@ -155,6 +155,14 @@ class PatchOnCommitFest(models.Model):
(STATUS_RETURNED, 'Returned with Feedback'),
(STATUS_REJECTED, 'Rejected'),
)
+ _STATUS_LABELS=(
+ (STATUS_REVIEW, 'default'),
+ (STATUS_AUTHOR, 'primary'),
+ (STATUS_COMMITTER, 'info'),
+ (STATUS_COMMITTED, 'success'),
+ (STATUS_RETURNED, 'warning'),
+ (STATUS_REJECTED, 'danger'),
+ )
OPEN_STATUSES=(STATUS_REVIEW, STATUS_AUTHOR, STATUS_COMMITTER)
OPEN_STATUS_CHOICES=[x for x in _STATUS_CHOICES if x[0] in OPEN_STATUSES]
diff --git a/pgcommitfest/commitfest/templates/commitfest.html b/pgcommitfest/commitfest/templates/commitfest.html
index 056808f..04cf111 100644
--- a/pgcommitfest/commitfest/templates/commitfest.html
+++ b/pgcommitfest/commitfest/templates/commitfest.html
@@ -74,7 +74,7 @@
{%endif%}
<tr>
<td><a href="{{p.id}}/">{{p}}</a></td>
- <td><span class="label label-default">{{p.status|patchstatusstring}}</span></td>
+ <td><span class="label label-{{p.status|patchstatuslabel}}">{{p.status|patchstatusstring}}</span></td>
<td>{{p.author_names|default:''}}</td>
<td>{{p.reviewer_names|default:''}}</td>
<td>{{p.committer|default:''}}</p>
diff --git a/pgcommitfest/commitfest/templatetags/commitfest.py b/pgcommitfest/commitfest/templatetags/commitfest.py
index 07b5ea4..b8f68e4 100644
--- a/pgcommitfest/commitfest/templatetags/commitfest.py
+++ b/pgcommitfest/commitfest/templatetags/commitfest.py
@@ -11,6 +11,12 @@ def patchstatusstring(value):
i = int(value)
return [v for k,v in PatchOnCommitFest._STATUS_CHOICES if k==i][0]
+@register.filter(name='patchstatuslabel')
+@stringfilter
+def patchstatuslabel(value):
+ i = int(value)
+ return [v for k,v in PatchOnCommitFest._STATUS_LABELS if k==i][0]
+
@register.filter(is_safe=True)
def label_class(value, arg):
return value.label_tag(attrs={'class': arg})