incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [2/3] git commit: [#5951] Fixed AttributeError when _milestone field not of type milestone, and made behavior of all milestone-type field consistent
Date Wed, 27 Mar 2013 19:56:38 GMT
[#5951] Fixed AttributeError when _milestone field not of type milestone, and made behavior
of all milestone-type field consistent

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/cj/5951
Commit: 2c2ea6c54878f0cbda553cc47649ff052aede5f7
Parents: 2831109
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Wed Mar 27 18:41:35 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Mar 27 18:41:35 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/templates/tracker/ticket.html     |    2 +
 ForgeTracker/forgetracker/widgets/ticket_form.py   |   18 ++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2c2ea6c5/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 1d229fe..333b371 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -88,6 +88,8 @@
                 {% else %}
                   nobody
                 {% endif %}
+              {% elif field.type == 'milestone' %}
+                <a href="{{c.app.url}}{{field.name[1:]}}/{{ticket.custom_fields[field.name]}}">{{ticket.custom_fields[field.name]}}</a>
               {% else %}
                 {{ticket.custom_fields[field.name]}}
               {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2c2ea6c5/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 465dce5..aaba037 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -37,13 +37,7 @@ class GenericTicketForm(ew.SimpleForm):
     def display_field_by_name(self, idx, ignore_errors=False):
         field = self.fields[idx]
         ctx = self.context_for(field)
-        if idx == '_milestone':
-            milestone_value = ctx.value
-            for milestone in reversed(field.options):  # reverse so del hits the correct
indexes
-                if milestone.complete and (milestone.py_value != milestone_value):
-                    del field.options[field.options.index(milestone)]
-            ctx = self.context_for(field)
-        elif idx == 'assigned_to':
+        if idx == 'assigned_to':
             self._add_current_value_to_user_field(field, ctx.get('value'))
         elif idx == 'custom_fields':
             for cf in c.app.globals.custom_fields:
@@ -154,7 +148,7 @@ class TicketCustomField(object):
                 py_value=m.name,
                 complete=bool(m.complete)))
 
-        ssf = ew.SingleSelectField(
+        ssf = MilestoneField(
             label=field.label, name=str(field.name),
             options=options)
         return ssf
@@ -183,3 +177,11 @@ class TicketCustomField(object):
     def make(cls, field):
         factory = cls.SELECTOR.get(field.get('type'), cls._default)
         return factory(field)
+
+class MilestoneField(ew.SingleSelectField):
+    def display(self, *args, **kwargs):
+        milestone_value = kwargs['value']
+        for milestone in reversed(self.options):  # reverse so del hits the correct indexes
+            if milestone.complete and (milestone.py_value != milestone_value):
+                del self.options[self.options.index(milestone)]
+        return super(MilestoneField, self).display(*args, **kwargs)


Mime
View raw message