From 6d835375c1ccb19efabb1768acfb0d361ef931b4 Mon Sep 17 00:00:00 2001 From: Kohei Yoshino Date: Tue, 23 Jan 2018 11:22:40 -0500 Subject: Bug 1428270 - Unwrappable content in summary can cause top buttons to bleed out of main content box --- Bugzilla/Template.pm | 12 ++++++++++++ .../BugModal/template/en/default/bug_modal/edit.html.tmpl | 2 +- template/en/default/bug/edit.html.tmpl | 2 +- template/en/default/list/table.html.tmpl | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index f93b025bf..87496a89e 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -683,6 +683,18 @@ sub create { return $var; }, + # Insert `` HTML tags to camel and snake case words in the + # given string so a long bug summary, for example, will be wrapped + # in a preferred manner rather than overflowing or expanding the + # parent element. Examples: + # * `test_switch_window_content.py` + # * `TestSwitchToWindowContent` + wbr => sub { + my ($var) = @_; + $var =~ s/([a-z])([A-Z\._])/$1$2/g; + return $var; + }, + xml => \&Bugzilla::Util::xml_quote , # This filter is similar to url_quote but used a \ instead of a % 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 324b7863c..02f18b7ad 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -202,7 +202,7 @@ no_label = 1 hide_on_edit = 1 %] -

[% bug.short_desc FILTER quoteUrls(bug) %]

+

[% bug.short_desc FILTER quoteUrls(bug) FILTER wbr %]

[% END %] [%# alias %] diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index 22e1ab05a..84a20b97e 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -253,7 +253,7 @@ ([% bug.alias FILTER html %]) [% END %] [% END %] - [% bug.short_desc FILTER quoteUrls(bug) %] + [% bug.short_desc FILTER quoteUrls(bug) FILTER wbr %] [% IF bug.check_can_change_field('short_desc', 0, 1) || bug.check_can_change_field('alias', 0, 1) %] (edit) diff --git a/template/en/default/list/table.html.tmpl b/template/en/default/list/table.html.tmpl index b1ab82a41..df2f6b349 100644 --- a/template/en/default/list/table.html.tmpl +++ b/template/en/default/list/table.html.tmpl @@ -230,7 +230,7 @@ col_abbrev.ellipsis) FILTER html %] [% ELSIF column == 'short_desc' || column == "short_short_desc" %] - [%- bug.$column.truncate(col_abbrev.maxlength, col_abbrev.ellipsis) FILTER html -%] + [%- bug.$column.truncate(col_abbrev.maxlength, col_abbrev.ellipsis) FILTER html FILTER wbr -%] [% ELSIF bug_fields.$column.type == constants.FIELD_TYPE_BUG_ID %] -- cgit v1.2.3-24-g4f1b