incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rjol...@apache.org
Subject svn commit: r1423108 - in /incubator/bloodhound/trunk/bloodhound_theme/bhtheme: templates/bloodhound_theme.html theme.py
Date Mon, 17 Dec 2012 19:40:30 GMT
Author: rjollos
Date: Mon Dec 17 19:40:29 2012
New Revision: 1423108

URL: http://svn.apache.org/viewvc?rev=1423108&view=rev
Log:
Refs #310: Refactoried population of fields in quick create ticket template.

Modified:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html?rev=1423108&r1=1423107&r2=1423108&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html Mon
Dec 17 19:40:29 2012
@@ -121,30 +121,12 @@
               <input type="text" id="field-summary"
                   name="field_summary" placeholder="Ticket summary" />
               <div class="form-horizontal">
-                <py:if test="qct.fields.product">
-                <label class="control-label" for="field-product">Product</label>
-                <div class="controls">
-                  ${field_select(qct.fields.product, None)}
-                </div>
-                </py:if>
-                <py:if test="qct.fields.version">
-                <label class="control-label" for="field-version">Version</label>
-                <div class="controls">
-                  ${field_select(qct.fields.version, None)}
-                </div>
-                </py:if>
-                <py:if test="qct.fields.type">
-                <label class="control-label" for="field-type">Type</label>
-                <div class="controls">
-                  ${field_select(qct.fields.type, None)}
-                </div>
-                </py:if>
-                <py:if test="qct.fields.component">
-                <label class="control-label" for="field-component">Component</label>
-                <div class="controls">
-                  ${field_select(qct.fields.component, None)}
-                </div>
-                </py:if>
+                <py:for each="field in qct.fields">
+                  <label class="control-label" for="field-${field.name}">${field.label}</label>
+                  <div class="controls">
+                    ${field_select(field, None)}
+                  </div>
+                </py:for>
               </div>
             </py:def>
             <py:choose test="">

Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1423108&r1=1423107&r2=1423108&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Mon Dec 17 19:40:29 2012
@@ -17,7 +17,7 @@
 #  under the License.
 
 from genshi.builder import tag
-from genshi.core import TEXT           
+from genshi.core import TEXT
 from genshi.filters.transform import Transformer
 
 from trac.core import *
@@ -175,7 +175,7 @@ class BloodhoundTheme(ThemeBase):
         app_short = self._get_whitelabelling()['application_short']
         tx = tx.end() \
             .select("body//div[@class='error']/h1") \
-            .map(lambda text: text.replace("Trac", app_short), TEXT)            
+            .map(lambda text: text.replace("Trac", app_short), TEXT)
                     
         return stream | tx
 
@@ -323,6 +323,8 @@ class BloodhoundTheme(ThemeBase):
 class QuickCreateTicketDialog(Component):
     implements(IRequestFilter, IRequestHandler)
 
+    qct_fields = ('product', 'version', 'type', 'component')
+
     # IRequestFilter(Interface):
 
     def pre_process_request(self, req, handler):
@@ -345,9 +347,10 @@ class QuickCreateTicketDialog(Component)
             fakereq = dummy_request(self.env)
             ticket = Ticket(self.env)
             tm._populate(fakereq, ticket, False)
-            fields = dict([f['name'], f] \
-                        for f in tm._prepare_fields(fakereq, ticket))
-            data['qct'] = { 'fields' : fields }
+            all_fields = dict([f['name'], f] \
+                              for f in tm._prepare_fields(fakereq, ticket))
+            data['qct'] = {'fields': [all_fields[k] for k in self.qct_fields
+                                      if k in all_fields]}
         return template, data, content_type
 
     # IRequestHandler methods



Mime
View raw message