]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 508713: Remove duplicated code in flag/list.html.tmpl - Patch by Frédéric Bucli...
authorlpsolit%gmail.com <>
Thu, 6 Aug 2009 16:08:36 +0000 (16:08 +0000)
committerlpsolit%gmail.com <>
Thu, 6 Aug 2009 16:08:36 +0000 (16:08 +0000)
template/en/default/flag/list.html.tmpl

index 1c1a25d4a55e41ad50f97bee965e9269634cc381..5681d0b1c4d5bce26a63e6180e4c2f597fd85f50 100644 (file)
     
     [%# Step 1b: Display UI for setting flag. %]
     [% IF (!type.flags || type.flags.size == 0) && type.is_active %]
-      <tr>
-        <td>&nbsp;</td>
-        <td>
-          <label title="[% type.description FILTER html %]"
-                 for="flag_type-[% type.id %]">
-            [%- type.name FILTER html FILTER no_break %]</label>
-        </td>
-        <td>
-          <select id="flag_type-[% type.id %]" name="flag_type-[% type.id %]" 
-                  title="[% type.description FILTER html %]"
-                  [% " disabled=\"disabled\"" UNLESS (type.is_requestable && user.can_request_flag(type)) || user.can_set_flag(type) %]
-                  onchange="toggleRequesteeField(this);"
-                  class="flag_select">
-            <option value="X"></option>
-            [% IF type.is_requestable && user.can_request_flag(type) %]
-              <option value="?">?</option>
-            [% END %]
-            [% IF user.can_set_flag(type) %]
-              <option value="+">+</option>
-              <option value="-">-</option>
-            [% END %]
-          </select>
-        </td>
-        [% IF any_flags_requesteeble %]
-          <td>
-            [% IF type.is_requestable && type.is_requesteeble %]
-              <span style="white-space: nowrap;">
-                [% IF Param('usemenuforusers') %]
-                  [% INCLUDE global/userselect.html.tmpl
-                             name     => "requestee_type-$type.id"
-                             id       => "requestee_type-$type.id"
-                             multiple => type.is_multiplicable * 3
-                             emptyok  => !type.is_multiplicable
-                             value    => ""
-                             custom_userlist => type.grant_list
-                  %]
-                [% ELSE %]
-                  (<input type="text" size="30" maxlength="255"
-                          id="requestee_type-[% type.id %]"
-                          name="requestee_type-[% type.id %]">)
-                [% END %]
-              </span>
-            [% END %]
-          </td>
-        [% END %]
-      </tr>
+
+      [% PROCESS flag_row first_cell_empty = 1 addl_text = "" %]
     [% END %]
   [% END %]
 
         <tr><td colspan="3"><hr></td></tr>
         [% separator_displayed = 1 %]
     [% END %]
-    <tr>
-      <td colspan="2">
-        addl. <label title="[% type.description FILTER html %]"
-                     for="flag_type-[% type.id %]">
-          [%- type.name FILTER html FILTER no_break %]</label>
-      </td>
-      <td>
-        <select id="flag_type-[% type.id %]" name="flag_type-[% type.id %]" 
-                title="[% type.description FILTER html %]"
-                [% " disabled=\"disabled\"" UNLESS (type.is_requestable && user.can_request_flag(type)) || user.can_set_flag(type) %]
-                onchange="toggleRequesteeField(this);"
-                class="flag_select">
-          <option value="X"></option>
-          [% IF type.is_requestable && user.can_request_flag(type) %]
-            <option value="?">?</option>
-          [% END %]
-          [% IF user.can_set_flag(type) %]
-            <option value="+">+</option>
-            <option value="-">-</option>
-          [% END %]
-        </select>
-      </td>
-      [% IF any_flags_requesteeble %]
-        <td>
-          [% IF type.is_requestable && type.is_requesteeble %]
-            <span style="white-space: nowrap;">
-              [% IF Param('usemenuforusers') %]
-                [% INCLUDE global/userselect.html.tmpl
-                           name     => "requestee_type-$type.id"
-                           id       => "requestee_type-$type.id"
-                           multiple => type.is_multiplicable * 3
-                           emptyok  => !type.is_multiplicable
-                           value    => ""
-                           custom_userlist => type.grant_list
-                %]
-              [% ELSE %]
-                (<input type="text" size="30" maxlength="255"
-                        id="requestee_type-[% type.id %]" 
-                        name="requestee_type-[% type.id %]">)
-              [% END %]
-            </span>
-          [% END %]
-        </td>
-      [% END %]
-    </tr>
-  [% END %]
 
+    [% PROCESS flag_row first_cell_empty = 0 addl_text = "addl." %]
+  [% END %]
 </table>
 
 [% ELSE %]
       [% END %]<br>
     [% END %]
   [% END %]
+[% END %]
+
+[%# Display a table row for unset flags %]
+
+[% BLOCK flag_row %]
+  <tr>
+  [% IF first_cell_empty %]
+    <td>&nbsp;</td>
+    <td>
+  [% ELSE %]
+    <td colspan="2">
+  [% END %]
+
+      [% addl_text FILTER html %]
+      <label title="[% type.description FILTER html %]" for="flag_type-[% type.id %]">
+        [%- type.name FILTER html FILTER no_break %]</label>
+    </td>
+    <td>
+      <select id="flag_type-[% type.id %]" name="flag_type-[% type.id %]"
+              title="[% type.description FILTER html %]"
+              [% " disabled=\"disabled\"" UNLESS (type.is_requestable && user.can_request_flag(type)) || user.can_set_flag(type) %]
+              onchange="toggleRequesteeField(this);"
+              class="flag_select">
+        <option value="X"></option>
+        [% IF type.is_requestable && user.can_request_flag(type) %]
+          <option value="?">?</option>
+        [% END %]
+        [% IF user.can_set_flag(type) %]
+          <option value="+">+</option>
+          <option value="-">-</option>
+        [% END %]
+      </select>
+    </td>
+    [% IF any_flags_requesteeble %]
+      <td>
+        [% IF type.is_requestable && type.is_requesteeble %]
+          <span style="white-space: nowrap;">
+            [% IF Param('usemenuforusers') %]
+              [% INCLUDE global/userselect.html.tmpl
+                         name     => "requestee_type-$type.id"
+                         id       => "requestee_type-$type.id"
+                         multiple => type.is_multiplicable * 3
+                         emptyok  => !type.is_multiplicable
+                         value    => ""
+                         custom_userlist => type.grant_list
+              %]
+            [% ELSE %]
+              (<input type="text" size="30" maxlength="255"
+                      id="requestee_type-[% type.id %]"
+                      name="requestee_type-[% type.id %]">)
+            [% END %]
+          </span>
+        [% END %]
+      </td>
+    [% END %]
+  </tr>
 [% END %]
\ No newline at end of file