You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2013/06/24 21:01:46 UTC

svn commit: r1496160 - in /bloodhound/trunk/bloodhound_theme/bhtheme: templates/bloodhound_theme.html theme.py

Author: rjollos
Date: Mon Jun 24 19:01:46 2013
New Revision: 1496160

URL: http://svn.apache.org/r1496160
Log:
Whitespace cleanup, removed unused import and replaced `dict` with dictionary literal.

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

Modified: bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html?rev=1496160&r1=1496159&r2=1496160&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html Mon Jun 24 19:01:46 2013
@@ -114,19 +114,19 @@
               </div>
 
               <!--! create ticket button + dropdown -->
-              <py:def function="field_select(field, value)">
+              <py:def function="field_select(field)">
                 <select id="field-${field.name}" name="field_${field.name}"
                     class="input-block-level" data-empty="true" data-field="${field.name}">
                   <option py:if="field.optional"></option>
                   <option py:for="option in field.options"
-                          selected="${value == option or None}"
+                          selected="${field.value == option or None}"
                           value = "$option"
                           py:content="option"></option>
                   <optgroup py:for="optgroup in field.optgroups"
                             py:if="optgroup.options"
                             label="${optgroup.label}">
                     <option py:for="option in optgroup.options"
-                            selected="${value == option or None}"
+                            selected="${field.value == option or None}"
                             value = "$option"
                             py:content="option"></option>
                   </optgroup>
@@ -169,9 +169,13 @@
                             <div class="control-group">
                               <py:for each="field in qct.fields">
                                 <label for="field-${field.name}">${field.label}</label>
-                                ${field_select(field, None)}
+                                ${field_select(field)}
                               </py:for>
                             </div>
+
+                            <py:for each="field in qct.hidden_fields">
+                              <input type="hidden" name="field_${field.name}" value="${field.value}" />
+                            </py:for>
                           </form>
 
                           <div class="controls">
@@ -314,7 +318,7 @@
                     <div class="control-group">
                       <py:for each="field in qct.fields">
                         <label for="field-${field.name}">${field.label}</label>
-                        ${field_select(field, None)}
+                        ${field_select(field)}
                       </py:for>
                     </div>
                   </form>

Modified: bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1496160&r1=1496159&r2=1496160&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Mon Jun 24 19:01:46 2013
@@ -474,11 +474,18 @@ class QuickCreateTicketDialog(Component)
             }
 
             product_field = all_fields['product']
-            if product_field and self.env.product:
-                product_field['value'] = self.env.product.prefix
-
-            data['qct'] = {'fields': [all_fields[k] for k in self.qct_fields
-                                      if k in all_fields]}
+            if product_field:
+                if self.env.product:
+                    product_field['value'] = self.env.product.prefix
+                else:
+                    product_field['value'] = product_field['options'][0]
+
+            data['qct'] = {
+                'fields': [all_fields[k] for k in self.qct_fields
+                           if k in all_fields],
+                'hidden_fields': [all_fields[k] for k in all_fields.keys()
+                                  if k not in self.qct_fields]
+            }
         return template, data, content_type
 
     # IRequestHandler methods