diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-06-10 01:36:54 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-06-10 01:36:54 +0300 |
commit | d9e3a6a06822c95ad2c23d9fb50e34d1528ca7f7 (patch) | |
tree | 1daa6b39a696ea3773683ef6920f3a00eb307d7b /app/assets/javascripts/lib | |
parent | e864bdf25b0082be8d0847fed6a2d16fe348ae59 (diff) | |
parent | b51a36cb2b34b63246beac2bd7ebf4f646ca906a (diff) |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into category-search-dropdown
# Conflicts:
# app/assets/javascripts/lib/common_utils.js.coffee
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/common_utils.js.coffee | 22 | ||||
-rw-r--r-- | app/assets/javascripts/lib/datetime_utility.js.coffee | 9 |
2 files changed, 30 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/common_utils.js.coffee b/app/assets/javascripts/lib/common_utils.js.coffee index 95c4dd319ab..cf7c27cb265 100644 --- a/app/assets/javascripts/lib/common_utils.js.coffee +++ b/app/assets/javascripts/lib/common_utils.js.coffee @@ -23,4 +23,26 @@ return if @isInGroupsPage() then $('body').data 'group' else null + jQuery.timefor = (time, suffix, expiredLabel) -> + + return '' unless time + + suffix or= 'remaining' + expiredLabel or= 'Past due' + + jQuery.timeago.settings.allowFuture = yes + + { suffixFromNow } = jQuery.timeago.settings.strings + jQuery.timeago.settings.strings.suffixFromNow = suffix + + timefor = $.timeago time + + if timefor.indexOf('ago') > -1 + timefor = expiredLabel + + jQuery.timeago.settings.strings.suffixFromNow = suffixFromNow + + return timefor + + ) window diff --git a/app/assets/javascripts/lib/datetime_utility.js.coffee b/app/assets/javascripts/lib/datetime_utility.js.coffee index ad1d1c70481..948d6dbf07e 100644 --- a/app/assets/javascripts/lib/datetime_utility.js.coffee +++ b/app/assets/javascripts/lib/datetime_utility.js.coffee @@ -12,6 +12,13 @@ $el.attr('title', gl.utils.formatDate($el.attr('datetime'))) ) - $timeagoEls.timeago() if setTimeago + if setTimeago + $timeagoEls.timeago() + $timeagoEls.tooltip('destroy') + + # Recreate with custom template + $timeagoEls.tooltip( + template: '<div class="tooltip local-timeago" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' + ) ) window |