incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/48] git commit: [#4790] add labels to the ticket list columns
Date Wed, 19 Dec 2012 16:25:53 GMT
[#4790] add labels to the ticket list columns


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a1241f1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a1241f1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a1241f1e

Branch: refs/heads/db/4790
Commit: a1241f1ebd8601c1b93ed87ebf1802ac7295ca2c
Parents: f4b209b
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Wed Dec 19 16:11:25 2012 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Wed Dec 19 16:11:25 2012 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py          |    4 ++-
 .../tracker_widgets/ticket_search_results.html     |    7 ++++++
 .../forgetracker/tests/functional/test_root.py     |    2 +
 ForgeTracker/forgetracker/tracker_main.py          |   16 +++++++++++++-
 4 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a1241f1e/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index a86a44a..6d6a5a4 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -63,7 +63,9 @@ class Globals(MappedClass):
                                                             'assigned_to': True,
                                                             'reported_by': True,
                                                             'created_date': True,
-                                                            'mod_date': True})
+                                                            'mod_date': True,
+                                                            'labels': True,
+                                                            })
 
     @classmethod
     def next_ticket_num(cls):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a1241f1e/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
index 298ea23..456f4f5 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
@@ -38,6 +38,13 @@
               <td>{% if t.created_date %}{{abbr_date(t.created_date)}}{% endif %}</td>
               {% elif col['name'] == 'mod_date' %}
               <td>{% if t.mod_date %}{{abbr_date(t.mod_date)}}{% endif %}</td>
+              {% elif col['name'] == 'labels' %}
+              <td>{#{{ ', '.join(t.labels) }} #}
+                  {%- for l in t.labels -%}
+                  <a href="{{c.app.url}}search?q=labels:{{h.urlquoteplus(l)}}">{{l}}</a>
+                    {%- if not loop.last -%},{%- endif -%}
+                  {%- endfor -%}
+              </td>
               {% elif col['name'] == 'votes' %}
                 <td>{{ t.votes }}</td>
               {% else %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a1241f1e/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index defa5c4..fa7b9e2 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1326,6 +1326,7 @@ class test_show_default_fields(TrackerTestController):
         assert '<td>Creator</td> <td><input type="checkbox" name="reported_by"
checked ></td>' in r
         assert '<td>Created</td> <td><input type="checkbox" name="created_date"
checked ></td>' in r
         assert '<td>Updated</td> <td><input type="checkbox" name="mod_date"
checked ></td>' in r
+        assert '<td>Labels</td> <td><input type="checkbox" name="labels"
checked ></td>' in r
         self.new_ticket(summary='test')
         M.MonQTask.run_ready()
         r = self.app.get('/bugs/search', params=dict(q='test'))
@@ -1345,6 +1346,7 @@ class test_show_default_fields(TrackerTestController):
         assert '<td>Creator</td> <td><input type="checkbox" name="reported_by"
></td>' in r
         assert '<td>Created</td> <td><input type="checkbox" name="created_date"
></td>' in r
         assert '<td>Updated</td> <td><input type="checkbox" name="mod_date"
></td>' in r
+        assert '<td>Labels</td> <td><input type="checkbox" name="labels"
></td>' in r
 
 
 def sidebar_contains(response, text):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a1241f1e/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index bad0ba5..612cd9e 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -85,6 +85,8 @@ def _mongo_col_to_solr_col(name):
         return 'created_date_dt'
     elif name == 'mod_date':
         return 'mod_date_dt'
+    elif name == 'labels':
+        return 'labels_s'
     else:
         for field in c.app.globals.sortable_custom_fields_shown_in_search():
             if name == field['name']:
@@ -366,7 +368,12 @@ def mongo_columns():
                dict(name='mod_date',
                     sort_name='mod_date',
                     label='Updated',
-                    active=c.app.globals.show_in_search['mod_date'])]
+                    active=c.app.globals.show_in_search['mod_date']),
+               dict(name='labels',
+                   sort_name='labels',
+                   label='Labels',
+                   active=c.app.globals.show_in_search['labels']),
+               ]
     for field in c.app.globals.sortable_custom_fields_shown_in_search():
         columns.append(
             dict(name=field['name'], sort_name=field['name'], label=field['label'], active=True))
@@ -406,7 +413,12 @@ def solr_columns():
                dict(name='mod_date',
                     sort_name='mod_date_dt',
                     label='Updated',
-                    active=c.app.globals.show_in_search['mod_date'])]
+                    active=c.app.globals.show_in_search['mod_date']),
+               dict(name='labels',
+                   sort_name='labels_s',
+                   label='Labels',
+                   active=c.app.globals.show_in_search['labels']),
+               ]
     for field in c.app.globals.sortable_custom_fields_shown_in_search():
         columns.append(dict(name=field['name'], sort_name=field['sortable_name'], label=field['label'],
active=True))
     if c.app.config.options.get('EnableVoting'):


Mime
View raw message