diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-11-08 23:06:54 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-11-08 23:06:54 +0300 |
commit | 9eb9d05b454a59fbe09e122d64935d1842206bc7 (patch) | |
tree | 58c9ba2aa04b4d373ac889cd0ed9223ccdf45540 /app/helpers | |
parent | c6d010986724faf10b46453d66eaca38a948fabf (diff) | |
parent | fa1ac47ef167e55d79a69d69596012fe5ac99d20 (diff) |
Merge branch 'upgrade-timeago' into 'master'
Replace jQuery.timeago with timeago.js
## What does this MR do?
Replaces jQuery.timeago with [timeago.js](https://github.com/hustcc/timeago.js)
## Are there points in the code the reviewer needs to double check?
* Check to make sure its working everywhere :smile:
* Check to make sure the timeago wording matches what we have now (I think I've got this down but an extra pair of :eyes: would help too)
## Why was this MR needed?
* The jQuery.timeago version we have is outdated
* timeago.js is smaller (7.19 KB => 4.52 KB)
* timeago.js has no jQuery dependency
* removes all inline javascript :crossed_swords: for timeago
## Screenshots (if relevant)
None
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
- [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
## What are the relevant issue numbers?
Closes #21793
See merge request !6274
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ebd78bf9888..c816b616631 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -151,7 +151,6 @@ module ApplicationHelper # time - Time object # placement - Tooltip placement String (default: "top") # html_class - Custom class for `time` element (default: "time_ago") - # skip_js - When true, exclude the `script` tag (default: false) # # By default also includes a `script` element with Javascript necessary to # initialize the `timeago` jQuery extension. If this method is called many @@ -163,22 +162,19 @@ module ApplicationHelper # `html_class` argument is provided. # # Returns an HTML-safe String - def time_ago_with_tooltip(time, placement: 'top', html_class: '', skip_js: false, short_format: false) + def time_ago_with_tooltip(time, placement: 'top', html_class: '', short_format: false) css_classes = short_format ? 'js-short-timeago' : 'js-timeago' css_classes << " #{html_class}" unless html_class.blank? - css_classes << ' js-timeago-pending' unless skip_js element = content_tag :time, time.to_s, class: css_classes, - datetime: time.to_time.getutc.iso8601, title: time.to_time.in_time_zone.to_s(:medium), - data: { toggle: 'tooltip', placement: placement, container: 'body' } - - unless skip_js - element << javascript_tag( - "$('.js-timeago-pending').removeClass('js-timeago-pending').timeago()" - ) - end + datetime: time.to_time.getutc.iso8601, + data: { + toggle: 'tooltip', + placement: placement, + container: 'body' + } element end |