summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/BugModal')
-rw-r--r--extensions/BugModal/Extension.pm31
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl13
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/header.html.tmpl1
-rw-r--r--extensions/BugModal/web/bug_modal.js3
4 files changed, 45 insertions, 3 deletions
diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm
index b1356bc34..f1f7fb5f0 100644
--- a/extensions/BugModal/Extension.pm
+++ b/extensions/BugModal/Extension.pm
@@ -20,9 +20,21 @@ use Bugzilla::User::Setting;
use Bugzilla::Util qw(trick_taint datetime_from html_quote time_ago);
use List::MoreUtils qw(any);
use Template::Stash;
+use JSON::XS qw(encode_json);
+use Scalar::Util qw(blessed);
our $VERSION = '1';
+use constant READABLE_BUG_STATUS_PRODUCTS => (
+ 'Core',
+ 'Toolkit',
+ 'Firefox',
+ 'Firefox for Android',
+ 'Firefox for iOS',
+ 'Bugzilla',
+ 'bugzilla.mozilla.org'
+);
+
# force skin to mozilla
sub settings_after_update {
my ($self, $args) = @_;
@@ -190,6 +202,25 @@ sub template_before_process {
vars => $vars,
});
+ if (any { $bug->product eq $_ } READABLE_BUG_STATUS_PRODUCTS) {
+ my @flags = map { { name => $_->name, status => $_->status } } @{$bug->flags};
+ $vars->{readable_bug_status_json} = encode_json({
+ dupe_of => $bug->dup_id,
+ id => $bug->id,
+ keywords => [ map { $_->name } @{$bug->keyword_objects} ],
+ priority => $bug->priority,
+ resolution => $bug->resolution,
+ status => $bug->bug_status,
+ flags => \@flags,
+ target_milestone => $bug->target_milestone,
+ map { $_->name => $_->bug_flag($bug->id)->value } @{$vars->{tracking_flags}},
+ });
+ # HTML4 attributes cannot be longer than this, so just skip it in this case.
+ if (length($vars->{readable_bug_status_json}) > 65536) {
+ delete $vars->{readable_bug_status_json};
+ }
+ }
+
# bug->choices loads a lot of data that we want to lazy-load
# just load the status and resolutions and perform extra checks here
# upstream does these checks in the bug/fields template
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 9ed5f28b7..a0b13feec 100644
--- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
@@ -312,6 +312,13 @@
[% END %]
[%# === status === %]
+[% IF readable_bug_status_json %]
+ [% readable_bug_status_span = BLOCK -%]
+ [%- %]<span id="readable-bug-status" data-readable-bug-status="[% readable_bug_status_json FILTER html %]"></span>
+ [% END %]
+
+ [% subtitle = [{ unfiltered = readable_bug_status_span }] %]
+[% END %]
[% WRAPPER bug_modal/module.html.tmpl
title = "Status"
@@ -321,10 +328,10 @@
[%# product %]
[% can_edit_product = bug.check_can_change_field("product", 0, 1) %]
[% WRAPPER bug_modal/field.html.tmpl
- field = bug_fields.product
- field_type = constants.FIELD_TYPE_SINGLE_SELECT
+ field = bug_fields.product
+ field_type = constants.FIELD_TYPE_SINGLE_SELECT
hide_on_edit = can_edit_product
- help = "describecomponents.cgi"
+ help = "describecomponents.cgi"
%]
<span class="spin-latch" id="product-latch" data-latch="#product-latch" data-for="#product-info">&#9656;</span>
<div class="spin-toggle" data-latch="#product-latch" data-for="#product-info">
diff --git a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
index e32f4c546..b86031b40 100644
--- a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
@@ -53,6 +53,7 @@
"extensions/BugModal/web/bug_modal.js",
"extensions/BugModal/web/comments.js",
"extensions/BugModal/web/ZeroClipboard/ZeroClipboard.min.js",
+ "js/bugzilla-readable-status-min.js",
"js/field.js",
"js/comments.js",
"js/util.js"
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index 6c72eb249..b3b378d26 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -735,6 +735,9 @@ $(function() {
var other = $(that.attr('id') == 'dup_id' ? '#bottom-dup_id' : '#dup_id');
other.val(that.val());
});
+ var rbs = $("#readable-bug-status");
+ var rbs_text = bugzillaReadableStatus.readable(rbs.data('readable-bug-status'));
+ rbs.text(rbs_text);
// add see-also button
$('.bug-urls-btn')