blob: 004b5ac41ffcd18d1e3698c05aaa5c0c88b082c8 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001[for fields.field_def.choices]
2 [define checked]No[end]
3 [define derived]No[end]
4 [for fields.values]
5 [is fields.values.val fields.field_def.choices.name]
6 [define checked]Yes[end]
7 [end]
8 [end]
9 [for fields.derived_values]
10 [is fields.derived_values.val fields.field_def.choices.name]
11 [define checked]Yes[end]
12 [define derived]Yes[end]
13 [end]
14 [end]
15
16 <label id="[fields.field_id]_[fields.field_def.choices.name]_label" class="enum_checkbox"
17 title="[is derived "Yes"]derived: [end][fields.field_def.choices.name][if-any fields.field_def.choices.docstring]: [fields.field_def.choices.docstring][end]"
18 [is derived "Yes"]style="font-style:italic"[end]>
19 <input type="checkbox" name="custom_[fields.field_id][is arg2 ""][else]_[arg2][end]"
20 value="[fields.field_def.choices.name]"
21 id="[arg0]_custom_[fields.field_id]_[fields.field_def.choices.idx]"
22 [is checked "Yes"]checked="checked"[end] [is derived "Yes"]disabled="disabled"[end]
23 aria-labelledby="[fields.field_id]_label [fields.field_id]_[fields.field_def.choices.name]_label">
24 [fields.field_def.choices.name]
25 </label>
26
27[end]
28
29
30[# Also include any oddball values as plain text with an _X_ icon.]
31[for fields.values]
32 [define already_shown]No[end]
33 [for fields.field_def.choices]
34 [is fields.field_def.choices.name fields.values.val]
35 [define already_shown]Yes[end]
36 [end]
37 [end]
38 [is already_shown "No"]
39 <span class="enum_checkbox"
40 title="This is not a defined choice for this field"
41 id="span_[arg0]_oddball_[fields.values.idx]">
42 <a id="[arg0]_oddball_[fields.values.idx]" class="remove_oddball x_icon"></a>[fields.values.val]
43 [# Below hidden input contains the value of the field for tracker_helpers._ParseIssueRequestFields ]
44 <input type="text" class="labelinput" id="input_[arg0]_oddball_[fields.values.idx]" size="20" name="label"
45 value="[fields.field_name]-[fields.values.val]" hidden>
46 </span>
47 [end]
48[end]
49
50<script type="text/javascript" nonce="[nonce]">
51runOnLoad(function() {
52 var oddballAnchors = document.getElementsByClassName("remove_oddball");
53 for (var i = 0; i < oddballAnchors.length; ++i) {
54 var oddballAnchor = oddballAnchors[[]i];
55
56 oddballAnchor.addEventListener("click", function(event) {
57 var oddballSpan = $("span_" + this.id);
58 oddballSpan.style.display = "none";
59 var oddballInput = $("input_" + this.id);
60 oddballInput.value = "";
61 event.preventDefault();
62 });
63 }
64});
65</script>
66