summaryrefslogtreecommitdiffstats
path: root/extensions/REMO/web
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/REMO/web')
-rw-r--r--extensions/REMO/web/js/moz_csa_discourse.js44
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() + ')'
+ );
+ });
+});