From ac997a9166d6ac7ab0822f6935679fa0394eeb58 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 18 Feb 2015 11:41:17 +0800 Subject: Bug 1118987: create a new bug form for discourse issues (based on form.reps.it) --- .htaccess | 1 + .../bug/create/comment-csa-discourse.txt.tmpl | 28 +++++++ .../en/default/bug/create/comment-remo-it.txt.tmpl | 12 --- .../bug/create/create-csa-discourse.html.tmpl | 88 ++++++++++++++++++++++ .../en/default/bug/create/create-remo-it.html.tmpl | 31 -------- extensions/REMO/web/js/moz_csa_discourse.js | 44 +++++++++++ 6 files changed, 161 insertions(+), 43 deletions(-) create mode 100644 extensions/REMO/template/en/default/bug/create/comment-csa-discourse.txt.tmpl create mode 100644 extensions/REMO/template/en/default/bug/create/create-csa-discourse.html.tmpl create mode 100644 extensions/REMO/web/js/moz_csa_discourse.js diff --git a/.htaccess b/.htaccess index 116c26118..7c7057e08 100644 --- a/.htaccess +++ b/.htaccess @@ -55,6 +55,7 @@ RewriteRule ^form[\.:]reps[\.:]budget$ enter_bug.cgi?product=Mozilla+Reps&format RewriteRule ^form[\.:]reps[\.:]swag$ enter_bug.cgi?product=Mozilla+Reps&format=remo-swag RewriteRule ^form[\.:]reps[\.:]it$ enter_bug.cgi?product=Mozilla+Reps&format=remo-it RewriteRule ^form[\.:]reps[\.:]payment$ page.cgi?id=remo-form-payment.html +RewriteRule ^form[\.:]csa[\.:]discourse$ enter_bug.cgi?product=Infrastructure+\%26\+Operations&format=csa-discourse RewriteRule ^form[\.:]employee[\.\-:]incident$ enter_bug.cgi?product=mozilla.org&format=employee-incident RewriteRule ^form[\.:]brownbag$ https://air.mozilla.org/requests RewriteRule ^form[\.:]finance$ enter_bug.cgi?product=Finance&format=finance diff --git a/extensions/REMO/template/en/default/bug/create/comment-csa-discourse.txt.tmpl b/extensions/REMO/template/en/default/bug/create/comment-csa-discourse.txt.tmpl new file mode 100644 index 000000000..4e65607e8 --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/comment-csa-discourse.txt.tmpl @@ -0,0 +1,28 @@ +[%# 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. + #%] + +[% USE Bugzilla %] +[% cgi = Bugzilla.cgi %] + +Name: +[%+ cgi.param('name') %] + +Mozillians.org Profile: +[%+ cgi.param('mozillian') %] + +Community Name: +[%+ cgi.param('community') %] + +Category Names: +[%+ cgi.param('discourse_names') %] + +Background Hex Code: +[%+ cgi.param('discourse_bg') || "-" %] + +Comments: +[%+ cgi.param('comments') || "-" %] diff --git a/extensions/REMO/template/en/default/bug/create/comment-remo-it.txt.tmpl b/extensions/REMO/template/en/default/bug/create/comment-remo-it.txt.tmpl index 7e95dd017..b95e05184 100644 --- a/extensions/REMO/template/en/default/bug/create/comment-remo-it.txt.tmpl +++ b/extensions/REMO/template/en/default/bug/create/comment-remo-it.txt.tmpl @@ -55,18 +55,6 @@ Hosting data: Domain Name: [%+ cgi.param('domain_name') %] -[% ELSIF item == "discourse" %] -:: Discourse Category - -Category Names: -[%+ cgi.param('discourse_names') %] - -Moderators: -[%+ cgi.param('discourse_mods') %] - -Background Hex Code: -[%+ cgi.param('discourse_bg') || "-" %] - [% ELSIF item == "other" %] :: Other diff --git a/extensions/REMO/template/en/default/bug/create/create-csa-discourse.html.tmpl b/extensions/REMO/template/en/default/bug/create/create-csa-discourse.html.tmpl new file mode 100644 index 000000000..691bc7155 --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/create-csa-discourse.html.tmpl @@ -0,0 +1,88 @@ +[%# 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. + #%] + +[% PROCESS global/variables.none.tmpl %] + +[% PROCESS global/header.html.tmpl + title = "Community IT Discourse Request" + style_urls = [ "extensions/REMO/web/styles/moz_reps.css" ] + javascript_urls = [ "extensions/REMO/web/js/moz_csa_discourse.js" ] +%] + +[% USE Bugzilla %] + + + +

Community IT Discourse Request

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ Please explain anything else this form does not include. +
+ +
+ +
+
+ +[% PROCESS global/footer.html.tmpl %] diff --git a/extensions/REMO/template/en/default/bug/create/create-remo-it.html.tmpl b/extensions/REMO/template/en/default/bug/create/create-remo-it.html.tmpl index a1085ae97..aeea160a4 100644 --- a/extensions/REMO/template/en/default/bug/create/create-remo-it.html.tmpl +++ b/extensions/REMO/template/en/default/bug/create/create-remo-it.html.tmpl @@ -67,10 +67,6 @@ function submitForm() { ) { fields.push('domain_name'); } - if (Dom.get('item_discourse').checked) { - fields.push('discourse_names'); - fields.push('discourse_mods'); - } if (Dom.get('item_other').checked) { fields.push('other_value'); } @@ -107,11 +103,6 @@ function setItemVisibility() { } else { Dom.addClass('domain', 'bz_default_hidden'); } - if (Dom.get('item_discourse').checked) { - Dom.removeClass('discourse', 'bz_default_hidden'); - } else { - Dom.addClass('discourse', 'bz_default_hidden'); - } if (Dom.get('item_other').checked) { Dom.removeClass('other', 'bz_default_hidden'); } else { @@ -189,10 +180,6 @@ function init() { -
- - -
@@ -236,24 +223,6 @@ function init() { - - - Discourse Category - - - Discourse Category Names:[% mandatory FILTER none %] - - - - Moderators:[% mandatory FILTER none %] - - - - Hex code of background of category tag: - - - - Other Item 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() + ')' + ); + }); +}); -- cgit v1.2.3-24-g4f1b