@@ -136,6 +136,21 @@ table#patchlist > thead {
background-color: white;
}
+table#patchlist > tbody > tr > td.tag-A {
+ text-align: center;
+ background-color: #ffe771;
+}
+
+table#patchlist > tbody > tr > td.tag-R {
+ text-align: center;
+ background-color: #c3fd98;
+}
+
+table#patchlist > tbody > tr > td.tag-T {
+ text-align: center;
+ background-color: #b4cfec;
+}
+
a.colinactive, a.colactive {
color: black;
text-decoration: none;
@@ -69,11 +69,11 @@ $(document).ready(function() {
{% endifequal %}
</th>
+{% for tag in project.tags %}
<th>
- <span
- title="{% for tag in project.tags %}{{tag.name}}{% if not forloop.last %} / {% endif %}{% endfor %}"
- >{% for tag in project.tags %}{{tag.abbrev}}{% if not forloop.last %}/{% endif %}{% endfor %}</span>
+ <span title="{{tag.name}}">{{tag.abbrev}}</span>
</th>
+{% endfor %}
<th>
{% ifequal order.name "date" %}
@@ -153,7 +153,9 @@ $(document).ready(function() {
{% endif %}
<td><a href="{% url 'patchwork.views.patch.patch' patch_id=patch.id %}"
>{{ patch.name|default:"[no subject]"|truncatechars:100 }}</a></td>
- <td style="white-space: nowrap;">{{ patch|patch_tags }}</td>
+{% for tag in project.tags %}
+ {{ patch|patch_tags:tag }}
+{% endfor %}
<td>{{ patch.date|date:"Y-m-d" }}</td>
<td>{{ patch.submitter|personify:project }}</td>
<td>{{ patch.delegate.username }}</td>
@@ -24,13 +24,10 @@ register = template.Library()
@register.filter(name='patch_tags')
-def patch_tags(patch):
- counts = []
- titles = []
- for tag in patch.project.tags:
- count = getattr(patch, tag.attr_name)
- titles.append('%d %s' % (count, tag.name))
- counts.append(str(count))
- return mark_safe('<span title="%s">%s</span>' % (
- ' / '.join(titles),
- ' '.join(counts)))
+def patch_tags(patch, tag):
+ count = getattr(patch, tag.attr_name)
+ count_str = str(count) if count else ''
+ class_str = "tag-%s" % tag.abbrev if count else ''
+ title = '%d %s' % (count, tag.name)
+ return mark_safe('<td class="%s"><span title="%s">%s</span></td>' %
+ (class_str, title, count_str))
- Use colors to distinguish the tags - Don't display any information when there's none (ie don't display "there's 0 r-b tag"). That part is something similar to what Thomas Petazzoni also did. v2: Rebase on top of upstream v3: Tweak a bit the colors Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- htdocs/css/style.css | 15 +++++++++++++++ patchwork/templates/patchwork/patch-list.html | 10 ++++++---- patchwork/templatetags/patch.py | 17 +++++++---------- 3 files changed, 28 insertions(+), 14 deletions(-)