From 1030251963d7f4e2c7da6cb0486b36529a558860 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Thu, 9 Oct 2014 22:15:21 -0400 Subject: Bug 1062775 - Create a form to create/update bounty tracking tracking attachments --- .../en/default/hook/bug/show-header-end.html.tmpl | 11 ++ .../hook/global/user-error-errors.html.tmpl | 4 + .../default/pages/attachment_bounty_form.html.tmpl | 194 +++++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 extensions/BMO/template/en/default/pages/attachment_bounty_form.html.tmpl (limited to 'extensions/BMO/template/en/default') diff --git a/extensions/BMO/template/en/default/hook/bug/show-header-end.html.tmpl b/extensions/BMO/template/en/default/hook/bug/show-header-end.html.tmpl index 5ab189045..ff2438ffd 100644 --- a/extensions/BMO/template/en/default/hook/bug/show-header-end.html.tmpl +++ b/extensions/BMO/template/en/default/hook/bug/show-header-end.html.tmpl @@ -8,6 +8,10 @@ [% style_urls.push('extensions/BMO/web/styles/edit_bug.css') %] [% javascript_urls.push('extensions/BMO/web/js/edit_bug.js') %] +[% IF user.is_insider %] + [% javascript_urls.push('extensions/BMO/web/js/attachment_bounty_form.js') %] + [% yui.push('selector') %] +[% END %] [% title = "$bug.bug_id – " %] [% IF bug.alias != '' %] [% title = title _ "($bug.alias) " %] @@ -16,3 +20,10 @@ [% javascript = javascript _ "document.title = document.title.replace(/^" _ terms.Bug _ " /, '');" %] +[% js_bug_id = bug.bug_id FILTER js %] +[% IF user.is_insider %] + [% javascript = javascript _ + "YAHOO.util.Event.onDOMReady(function () { " _ + "add_bounty_attachment('$js_bug_id'); });" + %] +[% END %] diff --git a/extensions/BMO/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/BMO/template/en/default/hook/global/user-error-errors.html.tmpl index aaf23fff5..9caf9bd29 100644 --- a/extensions/BMO/template/en/default/hook/global/user-error-errors.html.tmpl +++ b/extensions/BMO/template/en/default/hook/global/user-error-errors.html.tmpl @@ -37,4 +37,8 @@ [% title = "Too Many Bugs" %] Too many [% terms.bugs %] matched your selection criteria. +[% ELSIF error == "bounty_attachment_missing_reporter" %] + [% title = "Missing Reporter" %] + You must provide an email address for a bounty attachment. + [% END %] diff --git a/extensions/BMO/template/en/default/pages/attachment_bounty_form.html.tmpl b/extensions/BMO/template/en/default/pages/attachment_bounty_form.html.tmpl new file mode 100644 index 000000000..31a73b017 --- /dev/null +++ b/extensions/BMO/template/en/default/pages/attachment_bounty_form.html.tmpl @@ -0,0 +1,194 @@ +[%# 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 %] + +[% inline_style = BLOCK %] +#bounty_form { + padding: 10px; +} +#bounty_form .required:after { + content: " *"; + color: red; +} +#bounty_form .field_label { + font-weight: bold; + display: block; + text-align: left; +} +#bounty_form .field_desc { + padding-bottom: 3px; +} +#bounty_form .field_desc, +#bounty_form .head_desc { + width: 600px; + word-wrap: normal; +} +#bounty_form .head_desc { + padding-top: 5px; + padding-bottom: 12px; +} +#bounty_form .form_section { + margin-bottom: 10px; +} +#bounty_form textarea { + font-family: inherit; + font-size: inherit; +} +#bounty_form em { + font-size: 1em; +} +.yui-calcontainer { + z-index: 2; +} +[% END %] + +[% inline_javascript = BLOCK %] +function validateAndSubmit() { + 'use strict'; + var alert_text = ''; + var requiredLabels = YAHOO.util.Selector.query('label.required'); + if (requiredLabels) { + requiredLabels.forEach(function (label) { + var name = label.getAttribute('for'); + var ids = YAHOO.util.Selector.query( + '#bounty_form *[name="' + name + '"]' + ).map(function (e) { + return e.id + }); + + if (ids && ids[0]) { + if (!isFilledOut(ids[0])) { + var desc = label.textContent || name; + alert_text += + "Please enter a value for " + + desc.replace(/[\r\n]+/, "").replace(/\s+/g, " ") + + "\n"; + } + } + }); + } + + if (alert_text != '') { + alert(alert_text); + return false; + } + return true; +} +[% END %] + +[% PROCESS global/header.html.tmpl + title = "Bounty Attachment Form" + style = inline_style + javascript = inline_javascript + javascript_urls = [ 'extensions/BMO/web/js/form_validate.js', + 'js/field.js', 'js/util.js' ] + yui = [ "calendar", "selector" ] +%] + +[% USE Bugzilla %] +[% cgi = Bugzilla.cgi %] + +
+ + + + + +
+ Bounty Attachment for [% "$terms.Bug $bug.id" FILTER bug_link(bug.id) FILTER none %] +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ +
+ + + +
+ +
+ +
+ + + +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +

+ [ * + Required Field ] +

+
+ +[% PROCESS global/footer.html.tmpl %] -- cgit v1.2.3-24-g4f1b