]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1209219 - Add an option to the disable the "X months ago" format for dates
authorDylan Hardison <dylan@mozilla.com>
Thu, 9 Jun 2016 19:28:26 +0000 (15:28 -0400)
committerDylan Hardison <dylan@mozilla.com>
Thu, 9 Jun 2016 19:28:26 +0000 (15:28 -0400)
extensions/BugModal/Extension.pm
extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl
extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl
extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
extensions/BugModal/template/en/default/bug_modal/flags.html.tmpl
extensions/BugModal/template/en/default/bug_modal/rel_time.html.tmpl
extensions/BugModal/template/en/default/hook/global/setting-descs-settings.none.tmpl
extensions/BugModal/web/bug_modal.js

index b1700fddd1906ad0d58f9cc5d968823b9754ac3b..01faf06d596eb54ffa0605020be11ba0a71f0d9f 100644 (file)
@@ -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;
index 807f5772f4ed3db8de2d5397f4fa7a3e6572dc76..edec4542861ff513805298efbf01d7c0a5861d69 100644 (file)
       <table class="layout-table change-head default-collapsed" id="cc-[% comment.count FILTER none %]">
       <tr>
         <td class="comment-collapse-reason"
+            [% IF user.setting("ui_use_absolute_time") == "on" %]
+            title="[% comment.author.moz_nick FILTER html %] [[% comment.creation_ts FILTER time("%Y-%m-%d %H:%M %Z") FILTER html %]]">
+            [% ELSE %]
             title="[% comment.author.moz_nick FILTER html %] [[% comment.creation_ts FILTER time_duration FILTER html %]]">
+            [% END %]
             Comment hidden ([% comment.collapsed_reason FILTER html %])
         </td>
         <td class="comment-actions">
index f9d21949766dc0a26b862df096d963498c71a7d3..0604b41bc34d176f3f76e20c2a4b23fa11706a24 100644 (file)
             [% ELSE %]
               <span
             [% END %]
-              class="flag-name-status rel-time-title[% " activity-ref" IF activity_id %]"
-              title="[% flag.creation_date FILTER time_duration FILTER html %]"
+              [% IF user.setting("ui_use_absolute_time") == "on" %]
+                  class="flag-name-status abs-time-title[% " activity-ref" IF activity_id %]"
+                  title="[% flag.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="[% flag.creation_date FILTER time_duration FILTER html %]"
+              [% END %]
               data-time="[% flag.creation_date FILTER epoch FILTER none %]"
             >
               [%+ flag.type.name FILTER html %][% flag.status FILTER none %]
index f18d0e7b70db38bd263f283535e8826663195f22..f78f74e0bf856cb1f7310955a1554910f47e4632 100644 (file)
             [% ELSE %]
               (<span
             [% END %]
-              class="flag-name-status rel-time-title[% " activity-ref" IF activity_id %]"
-              title="[% ni.creation_date FILTER time_duration FILTER html %]"
+                   <!-- time("%Y-%m-%d %H:%M %Z") -->
+              [% 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 ? "</a>" : "</span>" %]
index 53b5c08ca61bf3bb22ce7cd55b9af9964cf900f9..6c49ef7846430fb4f6d2a960d6340c376045301c 100644 (file)
       [% ELSE %]
         <span
       [% END %]
-        class="rel-time-title[% " activity-ref" IF activity_id %]"
-        title="[% f.creation_date FILTER time_duration FILTER html %]"
+        [% IF user.setting("ui_use_absolute_time") == "on"  %]
+            class="abs-time-title[% " activity-ref" IF activity_id %]"
+            title="[% f.creation_date FILTER time('%Y-%m-%d %H:%M %Z') %]"
+        [% ELSE %]
+            class="rel-time-title[% " activity-ref" IF activity_id %]"
+            title="[% f.creation_date FILTER time_duration FILTER html %]"
+        [% END %]
         data-time="[% f.creation_date FILTER epoch FILTER none %]"
       >
         [% f.type.name FILTER html %]
index 26a1b709b4d6285900a79703b73f2898c4e9f6a5..8f8f4925b1d06dc7c51a8e057d608528604acee0 100644 (file)
@@ -9,13 +9,12 @@
 [%#
   # ts: timestamp
   #%]
-
+[% IF user.setting("ui_use_absolute_time") == "on" -%]
+<span class="rel-time-title" title="[% ts FILTER time_duration FILTER html %]" data-time="[% ts FILTER epoch FILTER none %]">
+  [%~ ts FILTER time("%Y-%m-%d %H:%M %Z"); ~%]
+</span>
+[% ELSE -%]
 <span class="rel-time" title="[% ts FILTER time("%Y-%m-%d %H:%M %Z") %]" data-time="[% ts FILTER epoch FILTER none %]">
-  [%~
-    IF content.defined;
-      content;
-    ELSE;
-      ts FILTER time_duration FILTER html;
-    END;
-  ~%]
+  [%~ ts FILTER time_duration FILTER html; ~%]
 </span>
+[% END -%]
\ No newline at end of file
index 4ca9c30037376ff85184eaf3b9bfd8a05c7d6d05..0a253b2826b73579ac22e293cbc6529ccd55fbaa 100644 (file)
@@ -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"
 %]
index 6e36c994d81f19962af856c15f170fbdd77d1d38..0dd9305c45440cf8b9ff75cd7cbffaaa00fe5ae2 100644 (file)
@@ -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' }