rails-timeago 2.15.0 → 2.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +26 -1
- data/README.md +12 -14
- data/lib/assets/javascripts/rails-timeago-all.js +6 -0
- data/lib/assets/javascripts/rails-timeago.js +1 -1
- data/lib/rails-timeago.rb +21 -17
- data/lib/rails-timeago/helper.rb +27 -11
- data/lib/rails-timeago/version.rb +4 -2
- data/rails-timeago.gemspec +38 -20
- data/vendor/assets/javascripts/jquery.timeago.js +5 -4
- data/vendor/assets/javascripts/locales/jquery.timeago.af.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.am.js +30 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.ar.js +12 -4
- data/vendor/assets/javascripts/locales/jquery.timeago.az-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.az.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.be.js +43 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.bg.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.bs.js +13 -7
- data/vendor/assets/javascripts/locales/jquery.timeago.ca.js +30 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.cs.js +34 -24
- data/vendor/assets/javascripts/locales/jquery.timeago.cy.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.da.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.de-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.de.js +29 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.dv.js +32 -22
- data/vendor/assets/javascripts/locales/jquery.timeago.el.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.en-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.eo.js +30 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.es-short.js +31 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.es.js +29 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.et.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.eu.js +28 -17
- data/vendor/assets/javascripts/locales/jquery.timeago.fa-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.fa.js +32 -22
- data/vendor/assets/javascripts/locales/jquery.timeago.fi.js +38 -28
- data/vendor/assets/javascripts/locales/jquery.timeago.fr-short.js +26 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.fr.js +27 -17
- data/vendor/assets/javascripts/locales/jquery.timeago.gl.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.he.js +26 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.hr.js +53 -48
- data/vendor/assets/javascripts/locales/jquery.timeago.hu.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.hy.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.id.js +29 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.is.js +29 -19
- data/vendor/assets/javascripts/locales/jquery.timeago.it-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.it.js +28 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.ja.js +29 -19
- data/vendor/assets/javascripts/locales/jquery.timeago.jv.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.ka.js +30 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.ko.js +31 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.ky.js +11 -3
- data/vendor/assets/javascripts/locales/jquery.timeago.lt.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.lv.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.mk.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.nl.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.no.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.pl.js +11 -3
- data/vendor/assets/javascripts/locales/jquery.timeago.pt-br-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.pt-br.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.pt-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.pt.js +26 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.ro.js +29 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.rs.js +53 -48
- data/vendor/assets/javascripts/locales/jquery.timeago.ru.js +13 -4
- data/vendor/assets/javascripts/locales/jquery.timeago.rw.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.si.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.sk.js +34 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.sl.js +45 -39
- data/vendor/assets/javascripts/locales/jquery.timeago.sq.js +26 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.sr.js +53 -48
- data/vendor/assets/javascripts/locales/jquery.timeago.sv.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.th.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.tr-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.tr.js +26 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.uk.js +11 -3
- data/vendor/assets/javascripts/locales/jquery.timeago.ur.js +30 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.uz.js +29 -19
- data/vendor/assets/javascripts/locales/jquery.timeago.vi.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.zh-CN.js +31 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.zh-TW.js +30 -20
- metadata +20 -21
- data/.gitignore +0 -22
- data/.travis.yml +0 -10
- data/Gemfile +0 -18
- data/Rakefile +0 -45
- data/spec/rails-timeago_spec.rb +0 -44
- data/spec/spec_helper.rb +0 -25
- data/spec/support/assets/javascripts/jquery.js +0 -4
- data/spec/support/stub.rb +0 -87
- data/spec/timeago/helper_spec.rb +0 -208
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d2f04682a7ba3fcb6eb2600fe9cc15a824ad2402be862b744f249a77cf7bf2c0
|
4
|
+
data.tar.gz: e2e4b06684047da1b141325b377acebe0e4925e4a6dafd0e5045e10e43886ede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55d4ab0cadb376c2e309f973d1f89858f3b72ab27a6fd46ddcda36684e3287d673ff567b927d715495a059d078452be05a708e48acbf97b2993caeede0216ed1
|
7
|
+
data.tar.gz: 2d31b69f140b157941212b44169e91a4e6d8cc008bfff0f8a222b086c8450691451ba8fef50a2ad8cd0753ad03b5258020d8386a0fcea83a5b9fc2730690a72d
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,34 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.19.1
|
4
|
+
|
5
|
+
* Maintenance release reducing gem archive size
|
6
|
+
|
7
|
+
## 2.19.0
|
8
|
+
|
9
|
+
* Update jquery-timeago and locales from upstream
|
10
|
+
* Reinitialize on ajaxSuccess event too (#34)
|
11
|
+
|
12
|
+
## 2.18.0
|
13
|
+
|
14
|
+
* Update jquery-timeago and locales from upstream
|
15
|
+
|
16
|
+
## 2.17.1
|
17
|
+
|
18
|
+
* Maintenance release without code changes
|
19
|
+
|
20
|
+
## 2.17.0
|
21
|
+
|
22
|
+
* Update jquery-timeago and locales from upstream
|
23
|
+
|
24
|
+
## 2.16.0
|
25
|
+
|
26
|
+
* Update jquery-timeago and locales from upstream
|
27
|
+
|
3
28
|
## 2.15.0
|
4
29
|
|
5
30
|
* Update jquery-timeago and locales from upstream
|
6
|
-
* Remove an use of
|
31
|
+
* Remove an use of deprecated "ready" event (compatible with jQuery 3.0) (#40)
|
7
32
|
|
8
33
|
## 2.14.0
|
9
34
|
|
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# rails-timeago
|
2
2
|
|
3
|
-
[![Gem Version](https://
|
4
|
-
[![Build Status](https://
|
5
|
-
[![Code Climate](https://codeclimate.com/github/jgraichen/rails-timeago.svg)](https://codeclimate.com/github/jgraichen/rails-timeago)
|
6
|
-
[![Dependency Status](https://gemnasium.com/jgraichen/rails-timeago.svg)](https://gemnasium.com/jgraichen/rails-timeago)
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/rails-timeago?logo=ruby)](https://rubygems.org/gems/rails-timeago)
|
4
|
+
[![Build Status](https://img.shields.io/travis/jgraichen/rails-timeago/master?logo=travis)](https://travis-ci.org/jgraichen/rails-timeago)
|
7
5
|
|
8
6
|
**rails-timeago** provides a timeago_tag helper to create time tags usable for
|
9
7
|
[jQuery Timeago](https://github.com/rmm5t/jquery-timeago) plugin.
|
@@ -34,21 +32,23 @@ Use the following to also include all available locale files:
|
|
34
32
|
|
35
33
|
//= require rails-timeago-all
|
36
34
|
|
35
|
+
If using a recent Rails with `rails-ujs`, jQuery might not be present anymore. You need to add `jquery-rails` to your `Gemfile` and load it, e.g.:
|
36
|
+
|
37
|
+
//= require jquery
|
38
|
+
//= require rails-timeago
|
39
|
+
//= require rails-timeago-all
|
40
|
+
|
37
41
|
## Usage
|
38
42
|
|
39
43
|
Use the timeago_tag helper like any other regular tag helper:
|
40
44
|
|
41
45
|
```erb
|
42
|
-
<%= timeago_tag Time.zone.now
|
46
|
+
<%= timeago_tag Time.zone.now limit: 10.days.ago %>
|
43
47
|
```
|
44
48
|
|
45
49
|
|
46
50
|
### Available options:
|
47
51
|
|
48
|
-
**nojs**
|
49
|
-
Add time ago in words as time tag content instead of absolute time.
|
50
|
-
(default: `false`)
|
51
|
-
|
52
52
|
**date_only**
|
53
53
|
Only print date as tag content instead of full time.
|
54
54
|
(default: `true`)
|
@@ -71,13 +71,13 @@ String that will be returned if time is `nil`.
|
|
71
71
|
|
72
72
|
**title**
|
73
73
|
A string or block that will be used to create a title attribute for timeago tags. It set to nil or false no title attribute will be set.
|
74
|
-
(default: `proc { |time, options| I18n.l time, :
|
74
|
+
(default: `proc { |time, options| I18n.l time, format: options[:format] }`)
|
75
75
|
|
76
76
|
All other options will be given as options to the time tag helper.
|
77
77
|
The above options can be assigned globally as defaults using
|
78
78
|
|
79
79
|
```ruby
|
80
|
-
Rails::Timeago.default_options :
|
80
|
+
Rails::Timeago.default_options limit: proc { 20.days.ago }
|
81
81
|
```
|
82
82
|
|
83
83
|
A global limit should always be given as a block that will be evaluated each time the rails `timeago_tag` helper is called. That avoids the limit becoming smaller the longer the application runs.
|
@@ -87,7 +87,7 @@ A global limit should always be given as a block that will be evaluated each tim
|
|
87
87
|
**rails-timeago 2** ships with a modified version of jQuery timeago that allows to include all locale files at once and set the locale via an option or per element via the `lang` attribute:
|
88
88
|
|
89
89
|
```erb
|
90
|
-
<%= timeago_tag Time.zone.now, :
|
90
|
+
<%= timeago_tag Time.zone.now, lang: :de %>
|
91
91
|
```
|
92
92
|
|
93
93
|
The following snippet will print a script tag that set the jQuery timeago locale according to your `I18n.locale`:
|
@@ -113,8 +113,6 @@ Do not forget to require the needed locale files by either require `rails-timeag
|
|
113
113
|
|
114
114
|
**rails-timeago** includes locale files for the following locales taken from [jQuery Timeago](https://github.com/rmm5t/jquery-timeago).
|
115
115
|
|
116
|
-
> de cy pl mk zh-CN bs en-short it fi es uk lt zh-TW sk hy ca pt el sv ar no fa fr pt-br tr he bg ko uz cz sl hu id hr ru nl fr-short da ja ro th
|
117
|
-
|
118
116
|
Your customized jQuery locale files must be changed to work with **rails-timeago 2**. Instead of defining your locale strings as `jQuery.timeago.settings.strings` you need to define them like this:
|
119
117
|
|
120
118
|
```js
|
@@ -1,9 +1,11 @@
|
|
1
1
|
// Rails timeago bootstrap with all locales
|
2
2
|
//= require rails-timeago
|
3
3
|
//= require locales/jquery.timeago.af.js
|
4
|
+
//= require locales/jquery.timeago.am.js
|
4
5
|
//= require locales/jquery.timeago.ar.js
|
5
6
|
//= require locales/jquery.timeago.az-short.js
|
6
7
|
//= require locales/jquery.timeago.az.js
|
8
|
+
//= require locales/jquery.timeago.be.js
|
7
9
|
//= require locales/jquery.timeago.bg.js
|
8
10
|
//= require locales/jquery.timeago.bs.js
|
9
11
|
//= require locales/jquery.timeago.ca.js
|
@@ -15,6 +17,7 @@
|
|
15
17
|
//= require locales/jquery.timeago.dv.js
|
16
18
|
//= require locales/jquery.timeago.el.js
|
17
19
|
//= require locales/jquery.timeago.en-short.js
|
20
|
+
//= require locales/jquery.timeago.eo.js
|
18
21
|
//= require locales/jquery.timeago.es-short.js
|
19
22
|
//= require locales/jquery.timeago.es.js
|
20
23
|
//= require locales/jquery.timeago.et.js
|
@@ -35,6 +38,7 @@
|
|
35
38
|
//= require locales/jquery.timeago.it.js
|
36
39
|
//= require locales/jquery.timeago.ja.js
|
37
40
|
//= require locales/jquery.timeago.jv.js
|
41
|
+
//= require locales/jquery.timeago.ka.js
|
38
42
|
//= require locales/jquery.timeago.ko.js
|
39
43
|
//= require locales/jquery.timeago.ky.js
|
40
44
|
//= require locales/jquery.timeago.lt.js
|
@@ -54,12 +58,14 @@
|
|
54
58
|
//= require locales/jquery.timeago.si.js
|
55
59
|
//= require locales/jquery.timeago.sk.js
|
56
60
|
//= require locales/jquery.timeago.sl.js
|
61
|
+
//= require locales/jquery.timeago.sq.js
|
57
62
|
//= require locales/jquery.timeago.sr.js
|
58
63
|
//= require locales/jquery.timeago.sv.js
|
59
64
|
//= require locales/jquery.timeago.th.js
|
60
65
|
//= require locales/jquery.timeago.tr-short.js
|
61
66
|
//= require locales/jquery.timeago.tr.js
|
62
67
|
//= require locales/jquery.timeago.uk.js
|
68
|
+
//= require locales/jquery.timeago.ur.js
|
63
69
|
//= require locales/jquery.timeago.uz.js
|
64
70
|
//= require locales/jquery.timeago.vi.js
|
65
71
|
//= require locales/jquery.timeago.zh-CN.js
|
data/lib/rails-timeago.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails-timeago/version'
|
4
|
+
require 'rails-timeago/helper'
|
3
5
|
|
4
6
|
module Rails
|
5
7
|
module Timeago
|
6
8
|
if defined?(::Rails::Engine)
|
7
9
|
class Engine < ::Rails::Engine # :nodoc:
|
8
|
-
initializer 'rails-timeago', :
|
10
|
+
initializer 'rails-timeago', group: :all do |_app|
|
9
11
|
ActiveSupport.on_load(:action_controller) do
|
10
12
|
include Rails::Timeago::Helper
|
11
13
|
end
|
@@ -17,8 +19,8 @@ module Rails
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
# Read or write global rails-timeago default options. If no options are
|
21
|
-
# the current defaults will be returned.
|
22
|
+
# Read or write global rails-timeago default options. If no options are
|
23
|
+
# given the current defaults will be returned.
|
22
24
|
#
|
23
25
|
# Available options:
|
24
26
|
# [:+nojs+]
|
@@ -34,8 +36,9 @@ module Rails
|
|
34
36
|
# (default: :default)
|
35
37
|
#
|
36
38
|
# [:+limit+]
|
37
|
-
# Set a limit for time ago tags. All dates before given limit will not
|
38
|
-
# Global limit should be given as a block to reevaluate
|
39
|
+
# Set a limit for time ago tags. All dates before given limit will not
|
40
|
+
# be converted. Global limit should be given as a block to reevaluate
|
41
|
+
# limit each time timeago_tag is called.
|
39
42
|
# (default: proc { 4.days.ago })
|
40
43
|
#
|
41
44
|
# [:+force+]
|
@@ -47,9 +50,10 @@ module Rails
|
|
47
50
|
# (default: '-')
|
48
51
|
#
|
49
52
|
def self.default_options(opts = nil)
|
50
|
-
@defaults ||=
|
53
|
+
@defaults ||= option_hash
|
51
54
|
if opts
|
52
|
-
@defaults.merge!
|
55
|
+
@defaults.merge! \
|
56
|
+
opts.extract!(*@defaults.keys.select {|k| opts.include?(k) })
|
53
57
|
else
|
54
58
|
@defaults
|
55
59
|
end
|
@@ -57,18 +61,18 @@ module Rails
|
|
57
61
|
|
58
62
|
# Reset options to default values
|
59
63
|
def self.reset_default_options
|
60
|
-
@defaults =
|
64
|
+
@defaults = option_hash
|
61
65
|
end
|
62
66
|
|
63
67
|
def self.option_hash
|
64
68
|
{
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
69
|
+
nojs: false,
|
70
|
+
force: false,
|
71
|
+
format: :default,
|
72
|
+
limit: proc { 4.days.ago },
|
73
|
+
date_only: true,
|
74
|
+
default: '-',
|
75
|
+
title: proc {|time, options| I18n.l time, format: options[:format] }
|
72
76
|
}
|
73
77
|
end
|
74
78
|
end
|
data/lib/rails-timeago/helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support/time'
|
2
4
|
|
3
5
|
module Rails
|
@@ -6,7 +8,9 @@ module Rails
|
|
6
8
|
# Create a time tag usable for jQuery timeago plugin.
|
7
9
|
#
|
8
10
|
# timeago_tag Time.zone.now
|
9
|
-
# => "<time datetime="2012-03-10T12:07:07+01:00"
|
11
|
+
# => "<time datetime="2012-03-10T12:07:07+01:00"
|
12
|
+
# title="Sat, 10 Mar 2012 12:07:07 +0100"
|
13
|
+
# data-time-ago="2012-03-10T12:07:07+01:00">2012-03-10</time>"
|
10
14
|
#
|
11
15
|
# Available options:
|
12
16
|
# [:+nojs+]
|
@@ -22,7 +26,8 @@ module Rails
|
|
22
26
|
# (default: :default)
|
23
27
|
#
|
24
28
|
# [:+limit+]
|
25
|
-
# Set a limit for time ago tags. All dates before given limit
|
29
|
+
# Set a limit for time ago tags. All dates before given limit
|
30
|
+
# will not be converted.
|
26
31
|
# (default: 4.days.ago)
|
27
32
|
#
|
28
33
|
# [:+force+]
|
@@ -35,15 +40,22 @@ module Rails
|
|
35
40
|
#
|
36
41
|
# All other options will be given as options to tag helper.
|
37
42
|
#
|
43
|
+
# rubocop:disable Metrics/AbcSize
|
44
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
45
|
+
# rubocop:disable Metrics/MethodLength
|
46
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
38
47
|
def timeago_tag(time, html_options = {})
|
39
48
|
time_options = Rails::Timeago.default_options
|
40
49
|
|
41
|
-
time_options = time_options.merge html_options.extract!(*time_options.keys.select
|
50
|
+
time_options = time_options.merge html_options.extract!(*time_options.keys.select do |k|
|
51
|
+
html_options.include?(k)
|
52
|
+
end)
|
42
53
|
return time_options[:default] if time.nil?
|
43
54
|
|
44
55
|
time_options[:format] = time_options[:format].call(time, time_options) if time_options[:format].is_a?(Proc)
|
45
56
|
if time_options[:title]
|
46
|
-
html_options
|
57
|
+
html_options[:title] =
|
58
|
+
time_options[:title].is_a?(Proc) ? time_options[:title].call(time, time_options) : time_options[:title]
|
47
59
|
end
|
48
60
|
time_options[:limit] = time_options[:limit].call if time_options[:limit].is_a?(Proc)
|
49
61
|
|
@@ -51,21 +63,25 @@ module Rails
|
|
51
63
|
now = Time.zone.now
|
52
64
|
limit = time_options[:limit]
|
53
65
|
limit < now ? limit...now : now...limit
|
54
|
-
else
|
55
|
-
nil
|
56
66
|
end
|
57
67
|
|
58
|
-
if time_options[:force]
|
59
|
-
html_options
|
68
|
+
if time_options[:force] || time_range.nil? || time_range.cover?(time)
|
69
|
+
html_options['data-time-ago'] = time.iso8601
|
60
70
|
end
|
61
71
|
time_tag time, timeago_tag_content(time, time_options), html_options
|
62
72
|
end
|
73
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
74
|
+
# rubocop:enable Metrics/MethodLength
|
75
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
76
|
+
# rubocop:enable Metrics/AbcSize
|
63
77
|
|
64
78
|
def timeago_tag_content(time, time_options = {}) # :nodoc:
|
65
|
-
time = time.to_date
|
66
|
-
|
79
|
+
time = time.to_date if time_options[:date_only]
|
80
|
+
if time_options[:nojs] && (time_options[:limit].nil? || time_options[:limit] < time)
|
81
|
+
return time_ago_in_words(time)
|
82
|
+
end
|
67
83
|
|
68
|
-
I18n.l time, :
|
84
|
+
I18n.l time, format: time_options[:format]
|
69
85
|
end
|
70
86
|
|
71
87
|
# Return a JavaScript tag to set jQuery timeago locale.
|
data/rails-timeago.gemspec
CHANGED
@@ -1,21 +1,39 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/rails-timeago/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'rails-timeago'
|
7
|
+
spec.version = Rails::Timeago::VERSION
|
8
|
+
spec.authors = ['Jan Graichen']
|
9
|
+
spec.email = ['jgraichen@altimos.de']
|
10
|
+
|
11
|
+
spec.summary = 'jQuery Timeago helper for Rails 3'
|
12
|
+
spec.description = 'A Rails Helper to create time tags usable for jQuery Timeago plugin'
|
13
|
+
spec.homepage = 'https://github.com/jgraichen/rails-timeago'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
17
|
+
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/jgraichen/rails-timeago'
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/jgraichen/rails-timeago/blob/master/CHANGELOG.md'
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
+
`git ls-files -z`.split("\x0").select do |f|
|
26
|
+
f.match %r{\A
|
27
|
+
((?:lib|vendor)/)|
|
28
|
+
((?:CHANGELOG.md|README.md|LICENSE|.*\.gemspec)\z)
|
29
|
+
}x
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
spec.bindir = 'exe'
|
34
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) {|f| File.basename(f) }
|
35
|
+
spec.require_paths = ['lib']
|
36
|
+
|
37
|
+
spec.add_dependency 'actionpack', '>= 3.1'
|
38
|
+
spec.add_dependency 'activesupport', '>= 3.1'
|
21
39
|
end
|
@@ -3,15 +3,15 @@
|
|
3
3
|
* updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
|
4
4
|
*
|
5
5
|
* @name timeago
|
6
|
-
* @version 1.
|
7
|
-
* @requires jQuery
|
6
|
+
* @version 1.6.7
|
7
|
+
* @requires jQuery >=1.5.0 <4.0
|
8
8
|
* @author Ryan McGeary
|
9
9
|
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
|
10
10
|
*
|
11
11
|
* For usage and examples, visit:
|
12
12
|
* http://timeago.yarp.com/
|
13
13
|
*
|
14
|
-
* Copyright (c) 2008-
|
14
|
+
* Copyright (c) 2008-2019, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
|
15
15
|
*/
|
16
16
|
|
17
17
|
(function (factory) {
|
@@ -53,7 +53,7 @@
|
|
53
53
|
prefixFromNow: null,
|
54
54
|
suffixAgo: "ago",
|
55
55
|
suffixFromNow: "from now",
|
56
|
-
inPast:
|
56
|
+
inPast: "any moment now",
|
57
57
|
seconds: "less than a minute",
|
58
58
|
minute: "about a minute",
|
59
59
|
minutes: "%d minutes",
|
@@ -143,6 +143,7 @@
|
|
143
143
|
// functions are called with context of a single element
|
144
144
|
var functions = {
|
145
145
|
init: function() {
|
146
|
+
functions.dispose.call(this);
|
146
147
|
var refresh_el = $.proxy(refresh, this);
|
147
148
|
refresh_el();
|
148
149
|
var $s = $t.settings;
|