summaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-11-29 20:45:21 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2012-11-29 20:45:21 +0100
commita22401a72e7addce908ea92988200134ff7f9560 (patch)
tree97d47746cc9d91695e4303df50c4080a4c7ebac5 /template
parent2792419ee44cb3d1ed8d33085d4ed39a26b60bbc (diff)
downloadbugzilla-a22401a72e7addce908ea92988200134ff7f9560.tar.gz
bugzilla-a22401a72e7addce908ea92988200134ff7f9560.tar.xz
Bug 802613: Merge common code of admin/custom_fields/create.html.tmpl and admin/custom_fields/edit.html.tmpl into a single template
r=dkl a=LpSolit
Diffstat (limited to 'template')
-rw-r--r--template/en/default/admin/custom_fields/create.html.tmpl130
-rw-r--r--template/en/default/admin/custom_fields/edit-common.html.tmpl193
-rw-r--r--template/en/default/admin/custom_fields/edit.html.tmpl141
3 files changed, 199 insertions, 265 deletions
diff --git a/template/en/default/admin/custom_fields/create.html.tmpl b/template/en/default/admin/custom_fields/create.html.tmpl
index fb7f06f86..185cfffb5 100644
--- a/template/en/default/admin/custom_fields/create.html.tmpl
+++ b/template/en/default/admin/custom_fields/create.html.tmpl
@@ -10,8 +10,6 @@
# none
#%]
-[% PROCESS "global/field-descs.none.tmpl" %]
-
[% javascript = BLOCK %]
[% INCLUDE "admin/custom_fields/cf-js.js.tmpl" %]
[% END %]
@@ -26,7 +24,7 @@
[%# set initial editability of fields such as Reverse Relationship Description %]
<script type="text/javascript">
-YAHOO.util.Event.onDOMReady(function() {onChangeType(document.getElementById('type'))});
+ YAHOO.util.Event.onDOMReady(function() {onChangeType(document.getElementById('type'))});
</script>
<p>
@@ -47,129 +45,11 @@ YAHOO.util.Event.onDOMReady(function() {onChangeType(document.getElementById('ty
</ul>
<form id="add_field" action="editfields.cgi" method="GET">
- <table border="0" cellspacing="0" cellpadding="5" id="edit_custom_field">
- <tr>
- <th class="narrow_label"><label for="name">Name:</label></th>
- <td>
- <input type="text" id="name" name="name" value="cf_" size="40" maxlength="64">
- </td>
-
- <th>
- <label for="enter_bug">Can be set on [% terms.bug %] creation:</label>
- </th>
- <td>
- <input type="checkbox" id="enter_bug" name="enter_bug" value="1"
- onchange="toggleCheckbox(this, 'new_bugmail');">
- </td>
- </tr>
- <tr>
- <th class="narrow_label"><label for="desc">Description:</label></th>
- <td><input type="text" id="desc" name="desc" value="" size="40"></td>
-
- <th>
- <label for="new_bugmail">Displayed in [% terms.bug %]mail for new [% terms.bugs %]:</label>
- </th>
- <td><input type="checkbox" id="new_bugmail" name="new_bugmail" value="1"></td>
- </tr>
- <tr>
- <th class="narrow_label"><label for="type">Type:</label></th>
- <td>
- <select id="type" name="type" onchange="onChangeType(this)">
- [% FOREACH type = field_types.keys %]
- [% NEXT IF type == constants.FIELD_TYPE_UNKNOWN %]
- <option value="[% type FILTER html %]">[% field_types.$type FILTER html %]</option>
- [% END %]
- </select>
- </td>
-
- <th><label for="obsolete">Is obsolete:</label></th>
- <td><input type="checkbox" id="obsolete" name="obsolete" value="1"></td>
- </tr>
- <tr>
- <th class="narrow_label"><label for="sortkey">Sortkey:</label></th>
- <td>
- <input type="text" id="sortkey" name="sortkey" size="6" maxlength="6">
- </td>
-
- <th align="right"><label for="is_mandatory">Is mandatory:</label></th>
- <td><input type="checkbox" id="is_mandatory" name="is_mandatory" value="1"></td>
- </tr>
-
- <tr>
- <th class="narrow_label">Long Description:</th>
- <td>
- [% INCLUDE global/textarea.html.tmpl
- name = 'long_desc'
- id = 'long_desc'
- minrows = 3
- maxrows = 5
- cols = 46
- defaultcontent = defaultcontent
- %]
- </td>
- <th>
- <label for="visibility_field_id">Field only appears when:</label>
- </th>
- <td>
- <select name="visibility_field_id" id="visibility_field_id"
- onchange="onChangeVisibilityField()">
- <option></option>
- [% FOREACH sel_field = Bugzilla.fields({ is_select => 1 }) %]
- <option value="[% sel_field.id FILTER html %]">
- [% sel_field.description FILTER html %]
- ([% sel_field.name FILTER html %])
- </option>
- [% END %]
- </select>
- <label for="visibility_values">
- <strong>is set to any of:</strong>
- </label>
- <select multiple="multiple" size="5" name="visibility_values"
- id="visibility_values" class="field_value">
- <option value=""></option>
- </select>
- </td>
- </tr>
-
- <tr>
- <th class="narrow_label">
- <label for="reverse_desc">Reverse Relationship Description:</label>
- </th>
- <td>
- <input type="text" id="reverse_desc" name="reverse_desc" value="" size="40" disabled="disabled">
- <br/>
- Use this label for the list of [% terms.bugs %] that link to
- [%+ terms.abug %] with this
- [%+ field_types.${constants.FIELD_TYPE_BUG_ID} FILTER html %]
- field. For example, if the description is "Is a duplicate of",
- the reverse description would be "Duplicates of this [% terms.bug %]".
- Leave blank to disable the list for this field.
- </td>
- <th>
- <label for="value_field_id">
- Field that controls the values<br>
- that appear in this field:
- </label>
- </th>
+ [% PROCESS "admin/custom_fields/edit-common.html.tmpl" %]
- <td>
- <select disabled="disabled" name="value_field_id" id="value_field_id">
- <option></option>
- [% FOREACH sel_field = Bugzilla.fields({ is_select => 1 }) %]
- <option value="[% sel_field.id FILTER html %]">
- [% sel_field.description FILTER html %]
- ([% sel_field.name FILTER html %])
- </option>
- [% END %]
- </select>
- </td>
- </tr>
- </table>
- <p>
- <input type="hidden" name="action" value="new">
- <input type="hidden" name="token" value="[% token FILTER html %]">
- <input type="submit" id="create" value="Create">
- </p>
+ <input type="hidden" name="action" value="new">
+ <input type="hidden" name="token" value="[% token FILTER html %]">
+ <input type="submit" id="create" value="Create">
</form>
<p>
diff --git a/template/en/default/admin/custom_fields/edit-common.html.tmpl b/template/en/default/admin/custom_fields/edit-common.html.tmpl
new file mode 100644
index 000000000..adf8d3ec4
--- /dev/null
+++ b/template/en/default/admin/custom_fields/edit-common.html.tmpl
@@ -0,0 +1,193 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[%# INTERFACE:
+ # field: Bugzila::Field; the current field being edited
+ #%]
+
+[% PROCESS "global/field-descs.none.tmpl" %]
+
+<table border="0" cellspacing="0" cellpadding="5" id="edit_custom_field">
+ <tr>
+ <th class="narrow_label"><label for="name">Name:</label></th>
+ <td>
+ [% IF field %]
+ [% field.name FILTER html %]
+ [% ELSE %]
+ <input type="text" id="name" name="name" value="cf_" size="40" maxlength="64">
+ [% END %]
+ </td>
+
+ <th>
+ <label for="enter_bug">Can be set on [% terms.bug %] creation:</label>
+ </th>
+ <td>
+ <input type="checkbox" id="enter_bug" name="enter_bug" value="1"
+ [%- " checked" IF field.enter_bug %]
+ onchange="toggleCheckbox(this, 'new_bugmail');">
+ </td>
+ </tr>
+
+ <tr>
+ <th class="narrow_label"><label for="desc">Description:</label></th>
+ <td>
+ <input type="text" id="desc" name="desc" size="40"
+ value="[% field.description FILTER html %]">
+ </td>
+
+ <th>
+ <label for="new_bugmail">Displayed in [% terms.bug %]mail for new [% terms.bugs %]:</label>
+ </th>
+ <td>
+ <input type="checkbox" id="new_bugmail" name="new_bugmail" value="1"
+ [%- " checked" IF field.mailhead %]>
+ </td>
+ </tr>
+
+ <tr>
+ <th class="narrow_label"><label for="type">Type:</label></th>
+ <td>
+ [% IF field %]
+ [% field_types.${field.type} FILTER html %]
+ [% ELSE %]
+ <select id="type" name="type" onchange="onChangeType(this)">
+ [% FOREACH type = field_types.keys %]
+ [% NEXT IF type == constants.FIELD_TYPE_UNKNOWN %]
+ <option value="[% type FILTER html %]">[% field_types.$type FILTER html %]</option>
+ [% END %]
+ </select>
+ [% END %]
+ </td>
+
+ <th><label for="obsolete">Is obsolete:</label></th>
+ <td>
+ <input type="checkbox" id="obsolete" name="obsolete" value="1"
+ [%- " checked" IF field.obsolete %]>
+ </td>
+ </tr>
+
+ <tr>
+ <th class="narrow_label"><label for="sortkey">Sortkey:</label></th>
+ <td>
+ <input type="text" id="sortkey" name="sortkey" size="6" maxlength="6"
+ value="[% field.sortkey FILTER html %]">
+ </td>
+
+ <th align="right"><label for="is_mandatory">Is mandatory:</label></th>
+ <td>
+ <input type="checkbox" id="is_mandatory" name="is_mandatory" value="1"
+ [%- ' checked="checked"' IF field.is_mandatory %]>
+ </td>
+ </tr>
+
+ <tr>
+ <th class="narrow_label">Long Description:</th>
+ <td>
+ [% INCLUDE global/textarea.html.tmpl
+ name = 'long_desc'
+ id = 'long_desc'
+ minrows = 3
+ maxrows = 5
+ cols = 46
+ defaultcontent = field.long_desc
+ %]
+ </td>
+
+ <th>
+ <label for="visibility_field_id">Field only appears when:</label>
+ </th>
+ <td>
+ <select name="visibility_field_id" id="visibility_field_id"
+ onchange="onChangeVisibilityField()">
+ <option></option>
+ [% FOREACH sel_field = Bugzilla.fields({ is_select => 1 }) %]
+ [% NEXT IF field && sel_field.id == field.id %]
+ <option value="[% sel_field.id FILTER html %]"
+ [% ' selected="selected"'
+ IF field && sel_field.id == field.visibility_field.id %]>
+ [% sel_field.description FILTER html %]
+ ([% sel_field.name FILTER html %])
+ </option>
+ [% END %]
+ </select>
+ <br>
+ <label for="visibility_values">
+ <strong>is set to any of:</strong>
+ </label>
+ <br>
+ <select multiple="multiple" size="5" name="visibility_values"
+ id="visibility_values" class="field_value">
+ [% IF field %]
+ [% FOREACH value = field.visibility_field.legal_values %]
+ <option value="[% value.id FILTER html %]"
+ [% " selected" IF field.visibility_values.contains(value) %]>
+ [% IF field.visibility_field.name == 'component' %]
+ [% display_value('product', value.product.name) FILTER html %]:
+ [% END %]
+ [%+ display_value(field.visibility_field.name, value.name) FILTER html %]
+ </option>
+ [% END %]
+ [% ELSE %]
+ <option value=""></option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ [% IF !field || field.is_select || field.type == constants.FIELD_TYPE_BUG_ID %]
+ <tr>
+ [% IF field.is_select %]
+ <th>&nbsp;</th>
+ <td>
+ <a href="editvalues.cgi?field=[% field.name FILTER uri %]">Edit legal values for this field</a>.
+ </td>
+ [% ELSE %]
+ <th class="narrow_label">
+ <label for="reverse_desc">Reverse Relationship Description:</label>
+ </th>
+ <td>
+ <input type="text" id="reverse_desc" name="reverse_desc" size="40"
+ value="[% field.reverse_desc FILTER html %]"
+ [% ' disabled="disabled"' IF !field %]>
+ <br>
+ Use this label for the list of [% terms.bugs %] that link to [% terms.abug %]
+ with this [% field_types.${constants.FIELD_TYPE_BUG_ID} FILTER html %] field.
+ For example, if the description is "Is a duplicate of", the reverse description
+ would be "Duplicates of this [% terms.bug %]". Leave blank to disable the list
+ for this field.
+ </td>
+ [% END %]
+
+ [% IF !field || field.is_select %]
+ <th class="narrow_label">
+ <label for="value_field_id">
+ Field that controls the values<br>
+ that appear in this field:
+ </label>
+ </th>
+ <td>
+ <select name="value_field_id" id="value_field_id"
+ [% ' disabled="disabled"' IF !field %]>
+ <option></option>
+ [% FOREACH sel_field = Bugzilla.fields({ is_select => 1 }) %]
+ [% NEXT IF field && sel_field.id == field.id %]
+ <option value="[% sel_field.id FILTER html %]"
+ [% ' selected="selected"' IF field && sel_field.id == field.value_field.id %]>
+ [% sel_field.description FILTER html %]
+ ([% sel_field.name FILTER html %])
+ </option>
+ [% END %]
+ </select>
+ </td>
+ [% ELSE %]
+ <th></th>
+ <td></td>
+ [% END %]
+ </tr>
+ [% END %]
+</table>
diff --git a/template/en/default/admin/custom_fields/edit.html.tmpl b/template/en/default/admin/custom_fields/edit.html.tmpl
index a1d739365..7cc09e6ec 100644
--- a/template/en/default/admin/custom_fields/edit.html.tmpl
+++ b/template/en/default/admin/custom_fields/edit.html.tmpl
@@ -10,8 +10,6 @@
# field: Bugzila::Field; the current field being edited
#%]
-[% PROCESS "global/field-descs.none.tmpl" %]
-
[% title = BLOCK %]
Edit the Custom Field '[% field.name FILTER html %]' ([% field.description FILTER html %])
[% END %]
@@ -34,145 +32,8 @@
</p>
<form id="edit_field" action="editfields.cgi" method="GET">
- <table border="0" cellspacing="0" cellpadding="5" id="edit_custom_field">
- <tr>
- <th class="narrow_label">Name:</th>
- <td>[% field.name FILTER html %]</td>
-
- <th>
- <label for="enter_bug">Can be set on [% terms.bug %] creation:</label>
- </th>
- <td><input type="checkbox" id="enter_bug" name="enter_bug" value="1"
- [%- " checked" IF field.enter_bug %]
- onchange="toggleCheckbox(this, 'new_bugmail');"></td>
- </tr>
- <tr>
- <th class="narrow_label"><label for="desc">Description:</label></th>
- <td><input type="text" id="desc" name="desc" size="40"
- value="[% field.description FILTER html %]"></td>
-
- <th>
- <label for="new_bugmail">Displayed in [% terms.bug %]mail for new [% terms.bugs %]:</label>
- </th>
- <td><input type="checkbox" id="new_bugmail" name="new_bugmail" value="1"
- [%- " checked" IF field.mailhead %]></td>
- </tr>
- <tr>
- <th class="narrow_label">Type:</th>
- <td>[% field_types.${field.type} FILTER html %]</td>
-
- <th><label for="obsolete">Is obsolete:</label></th>
- <td><input type="checkbox" id="obsolete" name="obsolete" value="1"
- [%- " checked" IF field.obsolete %]></td>
- </tr>
- <tr>
- <th class="narrow_label"><label for="sortkey">Sortkey:</label></th>
- <td>
- <input type="text" id="sortkey" name="sortkey" size="6" maxlength="6"
- value="[% field.sortkey FILTER html %]">
- </td>
- <th align="right"><label for="is_mandatory">Is mandatory:</label></th>
- <td><input type="checkbox" id="is_mandatory" name="is_mandatory" value="1"
- [%- ' checked="checked"' IF field.is_mandatory %]></td>
- </tr>
- <tr>
- <th class="narrow_label">Long Description:</th>
- <td>
- [% INCLUDE global/textarea.html.tmpl
- name = 'long_desc'
- id = 'long_desc'
- minrows = 3
- maxrows = 5
- cols = 46
- defaultcontent = field.long_desc
- %]
- </td>
- <th>
- <label for="visibility_field_id">Field only appears when:</label>
- </th>
- <td>
- <select name="visibility_field_id" id="visibility_field_id"
- onchange="onChangeVisibilityField()">
- <option></option>
- [% FOREACH sel_field = Bugzilla.fields({ is_select => 1 }) %]
- [% NEXT IF sel_field.id == field.id %]
- <option value="[% sel_field.id FILTER html %]"
- [% ' selected="selected"'
- IF sel_field.id == field.visibility_field.id %]>
- [% sel_field.description FILTER html %]
- ([% sel_field.name FILTER html %])
- </option>
- [% END %]
- </select>
- <label for="visibility_values">
- <strong>is set to any of:</strong>
- </label>
- <select multiple="multiple" size="5" name="visibility_values"
- id="visibility_values" class="field_value">
- [% FOREACH value = field.visibility_field.legal_values %]
- <option value="[% value.id FILTER html %]"
- [% " selected" IF field.visibility_values.contains(value) %]>
- [% IF field.visibility_field.name == 'component' %]
- [% display_value('product', value.product.name) FILTER html %]:
- [% END %]
- [%+ display_value(field.visibility_field.name, value.name) FILTER html %]
- </option>
- [% END %]
- </select>
- </td>
- </tr>
- [% IF field.type == constants.FIELD_TYPE_BUG_ID %]
- <tr>
- <th class="narrow_label">
- <label for="reverse_desc">Reverse Relationship Description:</label>
- </th>
- <td>
- <input type="text" id="reverse_desc" name="reverse_desc" size="40"
- value="[% field.reverse_desc FILTER html %]">
- <br/>
- Use this label for the list of [% terms.bugs %] that link to
- [%+ terms.abug %] with this
- [%+ field_types.${constants.FIELD_TYPE_BUG_ID} FILTER html %] field.
- For example, if the description is "Is a duplicate of",
- the reverse description would be "Duplicates of this [% terms.bug %]".
- Leave blank to disable the list for this field.
- </td>
- <td colspan="2">&nbsp;</td>
- </tr>
- [% END %]
- [% IF field.is_select %]
- <tr>
- <th>&nbsp;</th>
- <td>
- <a href="editvalues.cgi?field=[% field.name FILTER uri %]">Edit
- legal values for this field</a>.
- </td>
-
- <th>
- <label for="value_field_id">
- Field that controls the values<br>
- that appear in this field:
- </label>
- </th>
+ [% PROCESS "admin/custom_fields/edit-common.html.tmpl" field = field %]
- <td>
- <select name="value_field_id" id="value_field_id">
- <option></option>
- [% FOREACH sel_field = Bugzilla.fields({ is_select => 1 }) %]
- [% NEXT IF sel_field.id == field.id %]
- <option value="[% sel_field.id FILTER html %]"
- [% ' selected="selected"'
- IF sel_field.id == field.value_field.id %]>
- [% sel_field.description FILTER html %]
- ([% sel_field.name FILTER html %])
- </option>
- [% END %]
- </select>
- </td>
- </tr>
- [% END %]
- </table>
- <br>
<input type="hidden" name="action" value="update">
<input type="hidden" name="name" value="[% field.name FILTER html %]">
<input type="hidden" name="token" value="[% token FILTER html %]">