diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2016-06-09 22:10:51 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2016-06-09 22:10:51 +0000 |
commit | dbc4f71868b63a01b2da31d6330a834f05757501 (patch) | |
tree | 59959719f5407ea851be2373144fac3dcc3c310d /app/assets/javascripts/lib | |
parent | 5f803f0fd1676c5a77eaa800c3036729bac0db98 (diff) | |
parent | 24b64edf09f62645ddfaf96e825cc3ed3a76cf1c (diff) | |
download | gitlab-ce-dbc4f71868b63a01b2da31d6330a834f05757501.tar.gz |
Merge branch 'milestone-tooltip' into 'master'
Add milestone expire date to the right sidebar
## What does this MR do?
Shows milestone expire date tooltip in the sidebar. It also shows the tooltip when sidebar is collapsed.
## Are there points in the code the reviewer needs to double check?
`common_utils.js.coffee` and `milestones_helper.rb` should be reviewed deeply.
## What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/17355
## Screencast
![zngAcytBWq](/uploads/bd8514506aa5010aef9b081455ee90af/zngAcytBWq.gif)
See merge request !4448
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/common_utils.js.coffee | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/common_utils.js.coffee b/app/assets/javascripts/lib/common_utils.js.coffee new file mode 100644 index 00000000000..0000e99a650 --- /dev/null +++ b/app/assets/javascripts/lib/common_utils.js.coffee @@ -0,0 +1,24 @@ +((w) -> + + 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 |