diff options
author | Dylan William Hardison <dylan@mozilla.com> | 2015-02-18 04:41:17 +0100 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-02-18 04:41:17 +0100 |
commit | ac997a9166d6ac7ab0822f6935679fa0394eeb58 (patch) | |
tree | 165cbd385b61c3f03c5fb29b9223135c3edcf4f1 /extensions/REMO/web | |
parent | c8c9ad098624c0af1f440cd0e8d61e27767f2b6b (diff) | |
download | bugzilla-ac997a9166d6ac7ab0822f6935679fa0394eeb58.tar.gz bugzilla-ac997a9166d6ac7ab0822f6935679fa0394eeb58.tar.xz |
Bug 1118987: create a new bug form for discourse issues (based on form.reps.it)
Diffstat (limited to 'extensions/REMO/web')
-rw-r--r-- | extensions/REMO/web/js/moz_csa_discourse.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/extensions/REMO/web/js/moz_csa_discourse.js b/extensions/REMO/web/js/moz_csa_discourse.js new file mode 100644 index 000000000..a885588f6 --- /dev/null +++ b/extensions/REMO/web/js/moz_csa_discourse.js @@ -0,0 +1,44 @@ +/* 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. */ + +$(document).ready(function() { + 'use strict'; + + $('#tmRequestForm').submit(function (event) { + var mozillian_re = /^https?:\/\/mozillians.org\/([^\/]+\/)?u\/[^\/]+$/i; + var errors = []; + var missing = false; + + $('label.required').each(function (index) { + var id = $(this).attr("for"); + var input = $("#" + id); + + if (input.val() == "") { + input.addClass("missing"); + missing = true; + event.preventDefault(); + } + else { + input.removeClass("missing"); + } + }); + + if (missing) { + errors.push("There are missing required fields"); + } + + if (errors.length) { + alert(errors.join("\n")); + event.preventDefault(); + return; + } + + $('#short_desc').val( + "IT Discourse Request: " + $('#community').val() + ' (' + $('#name').val() + ')' + ); + }); +}); |