blob: b596e4cb50104ee72019b1b9573c1e6c17117238 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001[define title]Issue Template [template_name][end]
2[define category_css]css/ph_detail.css[end]
3[include "../framework/header.ezt" "showtabs"]
4
5<a href="/p/[projectname]/adminTemplates">&lsaquo; Back to template list</a><br><br>
6
7[if-any read_only][include "../framework/read-only-rejection.ezt"]
8[else]
9
10<h4>Issue Template</h4>
11
12[if-any new_template_form]
13 <form action="create.do" method="POST">
14[else]
15 <form action="detail.do" method="POST">
16[end]
17<input type="hidden" name="token" value="[form_token]">
18<input type="hidden" name="template" value="[template_name]">
19
20
21<table cellspacing="0" cellpadding="3" class="rowmajor vt">
22 <tr>
23 <th>Members only:</th>
24 <td>
25 <input type="checkbox"[if-any allow_edit][else]disabled[end] name="members_only" [if-any initial_members_only]checked[end]>
26 <label for="members_only_checkbox">Only offer this template to project members</label>
27 </td>
28 </tr>
29
30 <tr>
31 <th>Name:</th>
32 <td>
33 [if-any new_template_form]
34 <input type="text" name="name" value="[template_name]">
35 <span id="fieldnamefeedback" class="fielderror" style="margin-left:1em">
36 [if-any errors.name][errors.name][end]
37 </span>
38 [else]
39 [template_name]
40 <input type="hidden" name="name" value="[template_name]">
41 [end]
42 </td>
43 </tr>
44
45 <tr>
46 <th>Summary:</th>
47 <td>
48 [if-any allow_edit]
49 <input type="text" name="summary" size="60" class=acob" value="[initial_summary]"><br>
50 [else]
51 [initial_summary]<br>
52 [end]
53 <input type="checkbox" [if-any allow_edit][else]disabled[end] name="summary_must_be_edited" [if-any initial_must_edit_summary]checked[end]>
54 <label for="summary_must_be_edited_checkbox">Users must edit issue summary before submitting</label>
55 </td>
56 </tr>
57
58 <tr>
59 <th>Description:</th>
60 <td>
61 [if-any allow_edit]
62 <textarea name="content" rows="12" cols="75">[initial_content]</textarea>
63 [# Note: wrap="hard" has no effect on content_editor because we copy to a hidden field before submission.]
64 [else]
65 [initial_content]
66 [end]
67 </td>
68 </tr>
69
70 <tr>
71 <th>Status:</th>
72 <td>
73 [if-any allow_edit]
74 <select id="status" name="status">
75 <option style="display: none" value="[initial_status]"></option>
76 </select>
77 [else]
78 [initial_status]
79 [end]
80 </td>
81 </tr>
82
83 <tr>
84 <th>Owner:</th>
85 <td>
86 [if-any allow_edit]
87 <input id="owner_editor" type="text" name="owner" size="25" class="acob" value="[initial_owner]"
88 autocomplete="off">
89 <span id="fieldnamefeedback" class="fielderror" style="margin-left:1em">
90 [if-any errors.owner][errors.owner][end]
91 </span>
92 [else]
93 [initial_owner]<br>
94 [end]
95 <span>
96 <input type="checkbox" [if-any allow_edit][else]disabled[end] name="owner_defaults_to_member" style="margin-left:2em" [if-any initial_owner_defaults_to_member]checked[end]>
97 <label for="owner_defaults_to_member_checkbox">Default to member who is entering the issue</label>
98 </span>
99 </td>
100 </tr>
101
102 <tr>
103 <th>Components:</th>
104 <td>
105 [if-any allow_edit]
106 <input id="components" type="text" name="components" size="75" class="acob"
107 autocomplete="off" value="[initial_components]">
108 <span id="fieldnamefeedback" class="fielderror" style="margin-left:1em">
109 [if-any errors.components][errors.components][end]
110 </span>
111 [else]
112 [initial_components]
113 [end]
114 <br/>
115 <span>
116 <input type="checkbox" [if-any allow_edit][else]disabled[end] name="component_required" [if-any initial_component_required]checked[end]>
117 <label for="component_required_checkbox">Require at least one component</label>
118 </span>
119 </td>
120 </tr>
121
122 [if-any allow_edit][if-any uneditable_fields]
123 <tr id="res_fd_banner"><th></th>
124 <td style="text-align:left; border-radius:25px">
125 <span style="background:var(--chops-orange-50); padding:5px; margin-top:10px;padding-left:10px; padding-right:10px; border-radius:25px">
126 <span style="padding-right:7px">
127 Info: Disabled inputs occur when you are not allowed to edit that restricted field.
128 </span>
129 <i id="res_fd_message" class="material-icons inline-icon" style="font-weight:bold; font-size:14px; vertical-align: text-bottom; cursor: pointer">
130 close</i>
131 </span>
132 </td>
133 </tr>
134 [end][end]
135
136 [for fields]
137 [# TODO(jrobbins): determine applicability dynamically and update fields in JS]
138 [# approval subfields are shown below, not here]
139 [if-any fields.field_def.is_approval_subfield][else][if-any fields.field_def.is_phase_field][else]
140 <tr>
141 <th>[fields.field_name]:</th>
142 <td colspan="2">
143 [if-any allow_edit]
144 [if-any fields.is_editable]
145 [include "field-value-widgets.ezt" False "tmpl" False ""]
146 [else]
147 <input disabled value = "
148 [for fields.values]
149 [fields.values.val]
150 [end]
151 " style="text-align:right; width:12em" class="multivalued customfield" aria-labelledby="[fields.field_id]_label">
152 [end]
153 [else]
154 [for fields.values]
155 [fields.values.val]
156 [end]
157 [end]
158 </td>
159 <tr>
160 [end][end]
161 [end]
162
163 <tr>
164 <th>Labels:</th>
165 <td>
166 [include "label-fields.ezt" "all" ""]
167 </td>
168 </tr>
169
170 <tr>
171 <th>Template admins:</th>
172 <td>
173 [if-any allow_edit]
174 <input id="admin_names_editor" type="text" name="admin_names" size="75" class="acob" value="[initial_admins]"
175 autocomplete="off">
176 [else]
177 [initial_admins]
178 [end]
179 </td>
180 </tr>
181
182 [if-any approvals]
183 <tr>
184 <th>Launch Gates:</th>
185 <td colspan="7">
186 <input type="checkbox" name="add_approvals" id="cb_add_approvals" [if-any allow_edit][else]disabled[end] [if-any initial_add_approvals]checked="checked"[end]>
187 <label for="cb_add_approvals">Include Gates and Approval Tasks in issue</label>
188 [include "launch-gates-widget.ezt"]
189 <span id="fieldnamefeedback" class="fielderror" style="margin-left:1em">
190 [if-any errors.phase_approvals][errors.phase_approvals][end]
191 </span>
192 </td>
193 </tr>
194 [end]
195
196 [for fields]
197 [if-any fields.field_def.is_approval_subfield]
198 <tr id="subfield-row" class="subfield-row-class">
199 <th>[fields.field_def.parent_approval_name] [fields.field_name]:</th>
200 <td colspan="2">
201 [if-any allow_edit]
202 [if-any fields.is_editable]
203 [include "field-value-widgets.ezt" False "tmpl" False ""]
204 [else]
205 <input disabled value = "
206 [for fields.values]
207 [fields.values.val]
208 [end]
209 " style="text-align:right; width:12em" class="multivalued customfield" aria-labelledby="[fields.field_id]_label">
210 [end]
211 [else]
212 [for fields.values][fields.values.val][end]
213 [end]
214 </td>
215 </tr>
216 [end][end]
217
218 [if-any allow_edit]
219 <tr>
220 <td></td>
221 <td>
222 <input id="submit_btn" type="submit" name="submit" value="Save template">
223 <input id="delete_btn" type="submit" class="secondary" name="deletetemplate" value="Delete Template">
224 </td>
225 </tr>
226 [end]
227
228</table>
229</form>
230
231[include "field-value-widgets-js.ezt"]
232
233[end][# end if not read_only]
234
235<script type="text/javascript" nonce="[nonce]">
236runOnLoad(function() {
237
238 [if-any allow_edit]
239 let addPhasesCheckbox = document.getElementById('cb_add_approvals');
240 if (addPhasesCheckbox) {
241 addPhasesCheckbox.addEventListener('change', toggleGatesView);
242 }
243
244 var acobElements = document.getElementsByClassName("acob");
245 for (var i = 0; i < acobElements.length; ++i) {
246 var el = acobElements[[]i];
247 el.addEventListener("focus", function(event) {
248 _acrob(null);
249 _acof(event);
250 });
251 }
252
253 if ($("status")) {
254 _loadStatusSelect("[projectname]", "status", "[initial_status]");
255 $("status").addEventListener("focus", function(event) {
256 _acrob(null);
257 });
258 }
259
260 if($("res_fd_message")) {
261 $("res_fd_message").onclick = function(){
262 $("res_fd_banner").classList.add("hidden");
263 };
264 };
265
266 [else]
267
268 let labelInputs = document.getElementsByClassName("labelinput");
269 Array.prototype.forEach.call(labelInputs, labelInput => {
270 labelInput.disabled = true;
271 });
272 [end]
273
274 toggleGatesView();
275 function toggleGatesView() {
276 let addPhasesCheckbox = document.getElementById('cb_add_approvals');
277 if (addPhasesCheckbox === null) return;
278 let addPhases = addPhasesCheckbox.checked;
279 let subfieldRows = document.getElementsByClassName('subfield-row-class');
280 let phasefieldRows = document.getElementsByClassName('phasefield-row-class');
281 if (addPhases) {
282 $('launch-gates-table').classList.remove('hidden');
283 for (let i=0; i<subfieldRows.length; i++){
284 subfieldRows[[]i].classList.remove('hidden');
285 }
286 for (let i=0; i<phasefieldRows.length; i++){
287 phasefieldRows[[]i].classList.remove('hidden');
288 }
289 } else{
290 $('launch-gates-table').classList.add('hidden');
291 for (let i=0; i<subfieldRows.length; i++){
292 subfieldRows[[]i].classList.add('hidden');
293 }
294 for (let i=0; i<phasefieldRows.length; i++){
295 phasefieldRows[[]i].classList.add('hidden');
296 }
297 }
298 }
299
300});
301</script>
302
303[include "../framework/footer.ezt"]