diff options
4 files changed, 60 insertions, 28 deletions
diff --git a/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl index 7e4bc29d8..b752a47fe 100644 --- a/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl @@ -306,10 +306,8 @@ CASE 'bug_file_loc'; %] <a href="[% value FILTER html %]" target="_blank" rel="noreferrer" - [% UNLESS is_safe_url(value) %] - onclick="return confirmUnsafeURL(this.href)" - [% END %] - >[% value FILTER truncate(256, '…') FILTER html %]</a> + class="bug-url" data-safe="[% is_safe_url(value) ? 1 : 0 %]" + >[% value FILTER truncate(40) FILTER html %]</a> [% CASE 'see_also'; 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 9cfbd6727..8a3652673 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -454,11 +454,15 @@ [% unassigned = (bug.assigned_to.login == "nobody@mozilla.org") || (bug.assigned_to.login.search('\.bugs$')); - sub = - "Reporter: " _ bug.reporter.moz_nick - _ (unassigned ? ", Unassigned" : ", Assigned: " _ bug.assigned_to.moz_nick) - _ (bug.mentors.size ? ", Mentored" : "") - _ (needinfo.size ? ", NeedInfo" : "") + sub = []; + sub.push("Reporter: " _ bug.reporter.moz_nick); + sub.push(unassigned ? "Unassigned" : "Assigned: " _ bug.assigned_to.moz_nick); + IF bug.mentors.size; + sub.push("Mentored"); + END; + IF needinfo.size; + sub.push("NeedInfo"); + END; %] [% WRAPPER bug_modal/module.html.tmpl title = "People" @@ -645,7 +649,7 @@ %] [% WRAPPER bug_modal/module.html.tmpl title = "Tracking" - subtitle = sub.join(", ") + subtitle = sub collapsed = col %] [% WRAPPER fields_lhs %] @@ -834,11 +838,15 @@ IF bug.cf_crash_signature != ""; sub.push("crash signature"); END; + IF bug.bug_file_loc != ""; + loc_html = INCLUDE bug_url_link link_text="URL"; + sub.push({ unfiltered => loc_html }); + END; %] [% WRAPPER bug_modal/module.html.tmpl title = "Details" collapsed = 1 - subtitle = sub.join(", ") + subtitle = sub %] [% WRAPPER fields_lhs %] @@ -897,10 +905,7 @@ field_type = constants.FIELD_TYPE_FREETEXT hide_on_view = bug.bug_file_loc == "" %] - <a href="[% bug.bug_file_loc FILTER html %]" target="_blank" - rel="noreferrer" title="[% bug.bug_file_loc FILTER html %]" - [% UNLESS is_safe_url(bug.bug_file_loc) +%] class="unsafe-url"[% END %] - >[% bug.bug_file_loc FILTER truncate(40) FILTER html %]</a> + [% INCLUDE bug_url_link %] [% END %] [%# see also %] @@ -984,7 +989,7 @@ %] [% WRAPPER bug_modal/module.html.tmpl title = "Attachments" - subtitle = sub.join(", ") + subtitle = sub collapsed = active_attachments == 0 %] [% INCLUDE bug_modal/attachments.html.tmpl @@ -1060,3 +1065,15 @@ [% BLOCK fields_rhs %] <div class="fields-rhs">[% content FILTER none %]</div> [% END %] + +[% BLOCK bug_url_link %] +[% + IF !link_text.defined; + link_text = bug.bug_file_loc FILTER truncate(40); + END; +%] + <a href="[% bug.bug_file_loc FILTER html %]" target="_blank" + rel="noreferrer" title="[% bug.bug_file_loc FILTER truncate(256) FILTER html %]" + class="bug-url" data-safe="[% is_safe_url(bug.bug_file_loc) ? 1 : 0 %]" + >[% link_text FILTER html %]</a> +[% END %] diff --git a/extensions/BugModal/template/en/default/bug_modal/module.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/module.html.tmpl index 838069a58..a36747f97 100644 --- a/extensions/BugModal/template/en/default/bug_modal/module.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/module.html.tmpl @@ -9,7 +9,11 @@ [%# # title: (string, optional) main title of module # collapse: (boolean) if true, show as collapsed by default (default false) - # subtitle: (string, optional) sub-title + # subtitle: (optional) any of: + # a string + # an array of: (will be joined with ", ") + # string (will be filtered) + # { unfiltered: html } (will not be filtered) # content: (string, required) module's content (use WRAPPER module..) # hide_on_view: (boolean) if true, the module won't be visible in view mode # hide_on_edit: (boolean) if true, the module won't be visible in edit mode @@ -26,8 +30,17 @@ <div class="module-latch"> <div class="module-spinner">[% collapsed ? "▸" : "▾" %]</div> <div class="module-title">[% title FILTER html %]</div> - [% IF subtitle %] - <div class="module-subtitle">([% subtitle FILTER html %])</div> + [% IF subtitle != "" && subtitle.size %] + <div class="module-subtitle"> + ([% FOREACH st IN subtitle.list %] + [% IF st.unfiltered.defined %] + [% st.unfiltered FILTER none %] + [% ELSE %] + [% st FILTER html %] + [% END %] + [% ", " UNLESS loop.last %] + [% END %]) + </div> [% END %] </div> </div> diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index b1eb17b81..1a7f7ea81 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -81,16 +81,20 @@ $(function() { }); // url --> unsafe warning - $('.unsafe-url') + $('.bug-url') .click(function(event) { - event.preventDefault(); - if (confirm('This is considered an unsafe URL and could possibly be harmful. ' + - 'The full URL is:\n\n' + $(event.target).attr('title') + '\n\nContinue?')) - { - try { - window.open($(event.target).attr('title')); - } catch(ex) { - alert('Malformed URL'); + var that = $(this); + event.stopPropagation(); + if (!that.data('safe')) { + event.preventDefault(); + if (confirm('This is considered an unsafe URL and could possibly be harmful. ' + + 'The full URL is:\n\n' + that.attr('href') + '\n\nContinue?')) + { + try { + window.open(that.attr('href')); + } catch(ex) { + alert('Malformed URL'); + } } } }); |