From: Kohei Yoshino Date: Thu, 25 Apr 2019 21:38:08 +0000 (-0400) Subject: Bug 1546146 - Show bug types in See Also X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=729ee853034e4b75f7635431f547bae679a0b1c4;p=thirdparty%2Fbugzilla.git Bug 1546146 - Show bug types in See Also --- diff --git a/Bugzilla/BugUrl/Bugzilla/Local.pm b/Bugzilla/BugUrl/Bugzilla/Local.pm index 73086524e..9d3dda685 100644 --- a/Bugzilla/BugUrl/Bugzilla/Local.pm +++ b/Bugzilla/BugUrl/Bugzilla/Local.pm @@ -96,4 +96,9 @@ sub local_uri { return Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$bug_id"; } +sub bug { + my ($self) = @_; + return Bugzilla::Bug->new({id => $self->target_bug_id, cache => 1}); +} + 1; diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index b5affc46a..cde211b9d 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -775,6 +775,14 @@ sub create { 1 ], + # Create a short, readable label for the given URL. + # e.g. https://www.mozilla.org/firefox/ -> mozilla.org/firefox + pretty_url => sub { + my ($url) = @_; + $url =~ s/^\s*(?:https?:\/\/(?:www\.)?)?(.+?)\/?\s*$/$1/g; + return $url; + }, + # In CSV, quotes are doubled, and any value containing a quote or a # comma is enclosed in quotes. # If a field starts with either "=", "+", "-" or "@", it is preceded 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 3817e80d7..4131c2c58 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -1532,11 +1532,14 @@ [% BLOCK bug_url_link %] [% IF !link_text.defined; - link_text = bug.bug_file_loc FILTER truncate(40); + link_text = bug.bug_file_loc FILTER pretty_url FILTER truncate(40); END; %] - [% link_text FILTER html %] + [% END %] diff --git a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl index 6353b4a76..5d646f61e 100644 --- a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl @@ -359,20 +359,38 @@ END; [%# bug-urls, currently just see-also %] [% BLOCK bug_urls %] - [% FOREACH url IN values %] -
- [% IF url.isa('Bugzilla::BugUrl::Bugzilla::Local') %] - [% url.target_bug_id FILTER bug_link(url.target_bug_id, use_alias => 1) FILTER none %] - [% ELSE %] - [% url.name FILTER truncate(40) FILTER html %] - [% END %] + [% + # Process internal (bug) and external links separately + internal_links = []; + external_links = []; + FOREACH value IN values; + IF value.isa('Bugzilla::BugUrl::Bugzilla::Local'); + internal_links.push(value); + ELSE; + external_links.push(value); + END; + END; + %] + + [% IF edit %] + [% FOREACH link IN internal_links %] + + [% END %] + [% ELSE %] + [%# Show bugs by type %] + [% INCLUDE bug_list values=internal_links.pluck('bug') edit=0 %] + [% END %] + + [% FOREACH link IN external_links %] + [% END %] diff --git a/extensions/BugModal/web/bug_modal.css b/extensions/BugModal/web/bug_modal.css index 28e1013e9..af7fce9d5 100644 --- a/extensions/BugModal/web/bug_modal.css +++ b/extensions/BugModal/web/bug_modal.css @@ -137,6 +137,10 @@ a.activity-ref { transition: all .2s; } +.module-subtitle .link { + display: inline; +} + .module-spinner[aria-expanded="true"] ~ .module-subtitle { opacity: 0; } @@ -388,6 +392,11 @@ input[type="number"] { .field .value .bug-list .bug-type-label .icon { font-size: 16px; + vertical-align: text-bottom; +} + +.field .value div.link { + line-height: 1.5; } #field-value-dependencytree {