From patchwork Mon Aug 24 18:23:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Lespiau X-Patchwork-Id: 510267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 122FF1402A0 for ; Tue, 25 Aug 2015 04:33:24 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id E4B7B1A1D80 for ; Tue, 25 Aug 2015 04:33:23 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lists.ozlabs.org (Postfix) with ESMTP id C12E81A1D8B for ; Tue, 25 Aug 2015 04:24:45 +1000 (AEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 24 Aug 2015 11:24:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,739,1432623600"; d="scan'208";a="789969450" Received: from smarupud-mobl2.amr.corp.intel.com (HELO strange.amr.corp.intel.com) ([10.254.186.249]) by fmsmga002.fm.intel.com with ESMTP; 24 Aug 2015 11:24:44 -0700 From: Damien Lespiau To: patchwork@lists.ozlabs.org Subject: [PATCH 51/51] patch-list: Tweak how A/R/T tags are displayed Date: Mon, 24 Aug 2015 19:23:40 +0100 Message-Id: <1440440620-25937-52-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1440440620-25937-1-git-send-email-damien.lespiau@intel.com> References: <1440440620-25937-1-git-send-email-damien.lespiau@intel.com> X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" - 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. Signed-off-by: Damien Lespiau --- htdocs/css/style.css | 15 +++++++++++++++ patchwork/templates/patchwork/patch-list.html | 10 ++++++---- patchwork/templatetags/patch.py | 17 +++++++---------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 96575df..8f56dc1 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -136,6 +136,21 @@ table#patchlist > thead { background-color: white; } +table#patchlist > tbody > tr > td.tag-A { + text-align: center; + background-color: #bdecb6; +} + +table#patchlist > tbody > tr > td.tag-R { + text-align: center; + background-color: #c3fdb8; +} + +table#patchlist > tbody > tr > td.tag-T { + text-align: center; + background-color: #b4cfec; +} + a.colinactive, a.colactive { color: black; text-decoration: none; diff --git a/patchwork/templates/patchwork/patch-list.html b/patchwork/templates/patchwork/patch-list.html index c81fe88..ce60a38 100644 --- a/patchwork/templates/patchwork/patch-list.html +++ b/patchwork/templates/patchwork/patch-list.html @@ -69,11 +69,11 @@ $(document).ready(function() { {% endifequal %} +{% for tag in project.tags %} - {% for tag in project.tags %}{{tag.abbrev}}{% if not forloop.last %}/{% endif %}{% endfor %} + {{tag.abbrev}} +{% endfor %} {% ifequal order.name "date" %} @@ -153,7 +153,9 @@ $(document).ready(function() { {% endif %} {{ patch.name|default:"[no subject]"|truncatechars:100 }} - {{ patch|patch_tags }} +{% for tag in project.tags %} + {{ patch|patch_tags:tag }} +{% endfor %} {{ patch.date|date:"Y-m-d" }} {{ patch.submitter|personify:project }} {{ patch.delegate.username }} diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py index ea23ebd..43da69d 100644 --- a/patchwork/templatetags/patch.py +++ b/patchwork/templatetags/patch.py @@ -66,13 +66,10 @@ class EditablePatchNode(template.Node): return self.nodelist_true.render(context) @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('%s' % ( - ' / '.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('%s' % + (class_str, title, count_str))