From 37b2bd154be263e95edb3ca66420e0357535b183 Mon Sep 17 00:00:00 2001 From: Dylan Hardison Date: Thu, 9 Jun 2016 15:28:26 -0400 Subject: Bug 1209219 - Add an option to the disable the "X months ago" format for dates --- extensions/BugModal/Extension.pm | 6 ++++++ .../en/default/bug_modal/activity_stream.html.tmpl | 4 ++++ .../template/en/default/bug_modal/attachments.html.tmpl | 9 +++++++-- .../BugModal/template/en/default/bug_modal/edit.html.tmpl | 10 ++++++++-- .../template/en/default/bug_modal/flags.html.tmpl | 9 +++++++-- .../template/en/default/bug_modal/rel_time.html.tmpl | 15 +++++++-------- .../default/hook/global/setting-descs-settings.none.tmpl | 1 + extensions/BugModal/web/bug_modal.js | 6 +++--- 8 files changed, 43 insertions(+), 17 deletions(-) (limited to 'extensions') diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index b1700fddd..01faf06d5 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -342,6 +342,12 @@ sub install_before_final_checks { default => 'off', category => 'User Interface' }); + add_setting({ + name => 'ui_use_absolute_time', + options => ['on', 'off'], + default => 'off', + category => 'User Interface', + }); # ensure the correct skin is being used my $dbh = Bugzilla->dbh; 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 807f5772f..edec45428 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 @@ -158,7 +158,11 @@
+ [% ELSE %] title="[% comment.author.moz_nick FILTER html %] [[% comment.creation_ts FILTER time_duration FILTER html %]]"> + [% END %] Comment hidden ([% comment.collapsed_reason FILTER html %]) diff --git a/extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl index f9d219497..0604b41bc 100644 --- a/extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl @@ -68,8 +68,13 @@ [% ELSE %] [%+ flag.type.name FILTER html %][% flag.status FILTER none %] 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 f18d0e7b7..f78f74e0b 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -245,8 +245,14 @@ [% ELSE %] ( + [% IF user.setting("ui_use_absolute_time") == "on" %] + class="flag-name-status abs-time-title[% " activity-ref" IF activity_id %]" + title="[% ni.creation_date FILTER time("%Y-%m-%d %H:%M %Z") FILTER html %]" + [% ELSE %] + class="flag-name-status rel-time-title[% " activity-ref" IF activity_id %]" + title="[% ni.creation_date FILTER time_duration FILTER html %]" + [% END %] data-time="[% ni.creation_date FILTER epoch FILTER none %]" >NeedInfo [% activity_id ? "" : "" %] diff --git a/extensions/BugModal/template/en/default/bug_modal/flags.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/flags.html.tmpl index 53b5c08ca..6c49ef784 100644 --- a/extensions/BugModal/template/en/default/bug_modal/flags.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/flags.html.tmpl @@ -84,8 +84,13 @@ [% ELSE %] [% f.type.name FILTER html %] diff --git a/extensions/BugModal/template/en/default/bug_modal/rel_time.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/rel_time.html.tmpl index 26a1b709b..8f8f4925b 100644 --- a/extensions/BugModal/template/en/default/bug_modal/rel_time.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/rel_time.html.tmpl @@ -9,13 +9,12 @@ [%# # ts: timestamp #%] - +[% IF user.setting("ui_use_absolute_time") == "on" -%] + + [%~ ts FILTER time("%Y-%m-%d %H:%M %Z"); ~%] + +[% ELSE -%] - [%~ - IF content.defined; - content; - ELSE; - ts FILTER time_duration FILTER html; - END; - ~%] + [%~ ts FILTER time_duration FILTER html; ~%] +[% END -%] \ No newline at end of file diff --git a/extensions/BugModal/template/en/default/hook/global/setting-descs-settings.none.tmpl b/extensions/BugModal/template/en/default/hook/global/setting-descs-settings.none.tmpl index 4ca9c3003..0a253b282 100644 --- a/extensions/BugModal/template/en/default/hook/global/setting-descs-settings.none.tmpl +++ b/extensions/BugModal/template/en/default/hook/global/setting-descs-settings.none.tmpl @@ -9,4 +9,5 @@ [% setting_descs.ui_experiments = "Use experimental user interface" setting_descs.ui_remember_collapsed = "Remember visibility of header sections when viewing a bug" + setting_descs.ui_use_absolute_time = "Use absolute format instead of relative time when viewing a bug" %] diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index 6e36c994d..0dd9305c4 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -54,7 +54,7 @@ $(function() { var relative_timer_duration = 60000; var relative_timer_id = window.setInterval(relativeTimer, relative_timer_duration); $(document).on('show.visibility', function() { - relative_timer_id = window.setInterval(relativeTimer, relative_timer_duration) + relative_timer_id = window.setInterval(relativeTimer, relative_timer_duration); }); $(document).on('hide.visibility', function() { window.clearInterval(relative_timer_id); @@ -148,8 +148,8 @@ $(function() { $(this).hide(); }); - // use non-native tooltips for relative times and bug summaries - $('.rel-time, .rel-time-title, .bz_bug_link, .tt').tooltip({ + // use non-native tooltips for relative/absolute times and bug summaries + $('.rel-time, .rel-time-title, .abs-time-title, .bz_bug_link, .tt').tooltip({ position: { my: "left top+8", at: "left bottom", collision: "flipfit" }, show: { effect: 'none' }, hide: { effect: 'none' } -- cgit v1.2.3-24-g4f1b