summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2016-01-11 05:27:18 +0100
committerByron Jones <glob@mozilla.com>2016-01-11 05:27:18 +0100
commit9e478ddf25411f901bf552e8b85e5a0776775ea0 (patch)
tree63abc7cf08968e54dfe2df1489adef96a9244c00
parent9bc226afaf6c0108576f11d6a234ac48347dbbf5 (diff)
downloadbugzilla-9e478ddf25411f901bf552e8b85e5a0776775ea0.tar.gz
bugzilla-9e478ddf25411f901bf552e8b85e5a0776775ea0.tar.xz
Bug 1237185 - hide 'cab review' custom field behind a "click through" to direct people to servicenow
-rw-r--r--extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl42
-rw-r--r--extensions/BMO/web/js/edit_bug.js9
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl31
-rw-r--r--extensions/BugModal/web/bug_modal.js8
-rwxr-xr-xscripts/migrate-cab-review.pl2
5 files changed, 86 insertions, 6 deletions
diff --git a/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl b/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl
index c11e6ea42..d81299004 100644
--- a/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl
@@ -60,3 +60,45 @@
RETURN;
END;
%]
+
+[%
+ IF field.name == 'cf_cab_review' AND bug.cf_cab_review == '---';
+ field.hidden = 1;
+ value = '---';
+%]
+ [%# lifted from bug/field.html.tmpl %]
+ <tr>
+ [% PROCESS "bug/field-label.html.tmpl" hidden=0 %]
+ <td class="field_value" id="field_container_[% field.name FILTER html %]" colspan="2">
+ <span id="cab-review-gate">
+ <a href="https://mozilla.service-now.com/change_request.do?sysparm_stack=change_request_list.do&amp;sys_id=-1&amp;sysparm_query=active=true" target="_blank">ServiceNow Change Request</a>
+ (<a href="#" id="cab-review-gate-close">use flag</a>)
+ </span>
+ <span id="cab-review-edit" style="display:none">
+ <input type="hidden" id="[% field.name FILTER html %]_dirty">
+ <select id="[% field.name FILTER html %]" name="[% field.name FILTER html %]">
+ [%
+ FOREACH legal_value = field.legal_values;
+ NEXT IF NOT legal_value.is_active AND NOT value.contains(legal_value.name).size;
+ NEXT UNLESS bug.check_can_change_field(field.name, '---', legal_value.name)
+ OR value.contains(legal_value.name).size;
+ %]
+ <option value="[% legal_value.name FILTER html %]"
+ id="v[% legal_value.id FILTER html %]_[% field.name FILTER html %]"
+ [% IF value.contains(legal_value.name).size %]
+ selected
+ [% ELSIF bug AND !legal_value.is_visible_on_bug(bug) %]
+ class="bz_hidden_option" disabled
+ [% END %]
+ >[% display_value(field.name, legal_value.name) FILTER html %]</option>
+ [%
+ END;
+ %]
+ </select>
+ </span>
+ </td>
+ </tr>
+[%
+ RETURN;
+ END;
+%]
diff --git a/extensions/BMO/web/js/edit_bug.js b/extensions/BMO/web/js/edit_bug.js
index 87cbbba21..21c1d1709 100644
--- a/extensions/BMO/web/js/edit_bug.js
+++ b/extensions/BMO/web/js/edit_bug.js
@@ -45,3 +45,12 @@ YAHOO.util.Event.onDOMReady(function() {
new_comment.style.width = comment_width;
}
});
+
+$(function() {
+ $('#cab-review-gate-close')
+ .click(function(event) {
+ event.preventDefault();
+ $('#cab-review-gate').hide();
+ $('#cab-review-edit').show();
+ });
+})(jQuery);
diff --git a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
index b73761cff..c80c09f94 100644
--- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
@@ -772,11 +772,32 @@
[% UNLESS cf_hidden_in_product('cf_cab_review', bug.product, bug.component, bug) %]
[% rendered_custom_fields.push('cf_cab_review') %]
- [% INCLUDE bug_modal/field.html.tmpl
- field = bug_fields.cf_cab_review
- field_type = bug_fields.cf_cab_review.type
- hide_on_view = bug.cf_cab_review == "---"
- %]
+ [% IF bug.cf_cab_review == "---" %]
+ [% WRAPPER bug_modal/field.html.tmpl
+ field = bug_fields.cf_cab_review
+ field_type = bug_fields.cf_cab_review.type
+ container = 1
+ hide_on_view = 1
+ %]
+ <span id="cab-review-gate">
+ <a href="https://mozilla.service-now.com/change_request.do?sysparm_stack=change_request_list.do&amp;sys_id=-1&amp;sysparm_query=active=true" target="_blank">ServiceNow Change Request</a>
+ <button id="cab-review-gate-close" type="button" class="minor">Use Flag</button>
+ </span>
+ <span id="cab-review-edit" style="display:none">
+ [% INCLUDE bug_modal/field.html.tmpl
+ field = bug_fields.cf_cab_review
+ field_type = bug_fields.cf_cab_review.type
+ inline = 1
+ no_indent = 1
+ %]
+ </span>
+ [% END %]
+ [% ELSE %]
+ [% INCLUDE bug_modal/field.html.tmpl
+ field = bug_fields.cf_cab_review
+ field_type = bug_fields.cf_cab_review.type
+ %]
+ [% END %]
[% END %]
[% END %]
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index e1ea608a2..b2309ffe6 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -898,6 +898,14 @@ $(function() {
}
});
+ // cab review 'gate'
+ $('#cab-review-gate-close')
+ .click(function(event) {
+ event.preventDefault();
+ $('#cab-review-gate').hide();
+ $('#cab-review-edit').show();
+ });
+
// custom textarea fields
$('.edit-textarea-btn')
.click(function(event) {
diff --git a/scripts/migrate-cab-review.pl b/scripts/migrate-cab-review.pl
index 2d6a0c209..1c33a2a0f 100755
--- a/scripts/migrate-cab-review.pl
+++ b/scripts/migrate-cab-review.pl
@@ -11,7 +11,7 @@ use strict;
use warnings;
use FindBin qw($RealBin);
-use lib "$RealBin/../../..";
+use lib "$RealBin/..";
use Bugzilla;
use Bugzilla::Bug;