summaryrefslogtreecommitdiffstats
path: root/template/en/default/attachment/createformcontents.html.tmpl
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-03-28 15:08:56 +0200
committerDylan William Hardison <dylan@hardison.net>2017-03-28 15:09:20 +0200
commit9af56b965123c9312df5c1cc49b1e5aac67e70ae (patch)
treeb24224e4643469b2acdffa8f1d821b5e14ac28b4 /template/en/default/attachment/createformcontents.html.tmpl
parentdc6eca0cc8ab4dd41a5b5f618fa8e49b0fe194f7 (diff)
downloadbugzilla-9af56b965123c9312df5c1cc49b1e5aac67e70ae.tar.gz
bugzilla-9af56b965123c9312df5c1cc49b1e5aac67e70ae.tar.xz
Bug 1349769 - takebug should only be default for patch attachments
Diffstat (limited to 'template/en/default/attachment/createformcontents.html.tmpl')
-rw-r--r--template/en/default/attachment/createformcontents.html.tmpl22
1 files changed, 16 insertions, 6 deletions
diff --git a/template/en/default/attachment/createformcontents.html.tmpl b/template/en/default/attachment/createformcontents.html.tmpl
index 7f738c07f..1ab3893cd 100644
--- a/template/en/default/attachment/createformcontents.html.tmpl
+++ b/template/en/default/attachment/createformcontents.html.tmpl
@@ -28,7 +28,7 @@
<a id="attachment_data_controller" href="javascript:TUI_toggle_class('attachment_text_field');
javascript:TUI_toggle_class('attachment_data')"
>paste text as attachment</a>).<br>
- <input type="file" id="data" name="data" size="50" onchange="DataFieldHandler()">
+ <input type="file" id="data" name="data" size="50" >
</td>
</tr>
<tr class="attachment_text_field">
@@ -55,13 +55,23 @@
<td>
<em>If the attachment is a patch, check the box below.</em><br>
[% Hook.process("patch_notes") %]
- <input type="checkbox" id="ispatch" name="ispatch" value="1"
- onchange="setContentTypeDisabledState(this.form);">
+ <input type="checkbox" id="ispatch" name="ispatch" value="1">
<label for="ispatch">patch</label><br><br>
[%# Reset this whenever the page loads so that the JS state is up to date %]
- <script type="text/javascript">
- YAHOO.util.Event.onDOMReady(function() {
- bz_fireEvent(document.getElementById('ispatch'), 'change');
+ <script type="text/javascript" [% csp_nonce FILTER none %]>
+ $(function() {
+ $("#file").on("change", function() {
+ DataFieldHandler();
+ // Fire event to keep take-bug in sync.
+ $("#ispatch").change();
+ });
+ $("#ispatch").on("change", function() {
+ setContentTypeDisabledState(this.form);
+ var takebug = $("#takebug");
+ if (takebug.is(":visible") && takebug.data("take-if-patch") && $("#ispatch").prop("checked")) {
+ $("#takebug").prop("checked", true);
+ }
+ }).change();
});
</script>