From: Dylan William Hardison Date: Tue, 20 Nov 2018 23:20:03 +0000 (-0500) Subject: Bug 1508201 - move inline js on the buglist out to a separate file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0414625c9cfc99abac0e1d66aeb794d31ff4ac68;p=thirdparty%2Fbugzilla.git Bug 1508201 - move inline js on the buglist out to a separate file --- diff --git a/js/buglist.js b/js/buglist.js new file mode 100644 index 000000000..2e63775af --- /dev/null +++ b/js/buglist.js @@ -0,0 +1,23 @@ +function SetCheckboxes(value) { + let elements = document.querySelectorAll("input[type='checkbox'][name^='id_']"); + for (let item of elements) { + item.checked = value; + } +} + +document.addEventListener("DOMContentLoaded", () => { + let check_all = document.getElementById("check_all"); + let uncheck_all = document.getElementById("uncheck_all"); + if (check_all) { + check_all.addEventListener("click", event => { + SetCheckboxes(true); + event.preventDefault(); + }); + } + if (uncheck_all) { + uncheck_all.addEventListener("click", event => { + SetCheckboxes(false); + event.preventDefault(); + }); + } +}); diff --git a/template/en/default/list/edit-multiple.html.tmpl b/template/en/default/list/edit-multiple.html.tmpl index 1128a5e8e..8224a3040 100644 --- a/template/en/default/list/edit-multiple.html.tmpl +++ b/template/en/default/list/edit-multiple.html.tmpl @@ -27,23 +27,8 @@ [% dontchange = "--do_not_change--" %] - - - + +

diff --git a/template/en/default/list/list.html.tmpl b/template/en/default/list/list.html.tmpl index e8fc9083a..13ebacf0f 100644 --- a/template/en/default/list/list.html.tmpl +++ b/template/en/default/list/list.html.tmpl @@ -50,7 +50,7 @@ generate_api_token = dotweak style = style atomlink = basepath _ "buglist.cgi?$urlquerypart&title=$url_filtered_title&ctype=atom" - javascript_urls = [ "js/util.js", "js/field.js" ] + javascript_urls = [ "js/util.js", "js/field.js", "js/buglist.js" ] style_urls = [ "skins/standard/buglist.css" ] doc_section = "query.html#list" %]