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.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +26 -1
  3. data/README.md +12 -14
  4. data/lib/assets/javascripts/rails-timeago-all.js +6 -0
  5. data/lib/assets/javascripts/rails-timeago.js +1 -1
  6. data/lib/rails-timeago.rb +21 -17
  7. data/lib/rails-timeago/helper.rb +27 -11
  8. data/lib/rails-timeago/version.rb +4 -2
  9. data/rails-timeago.gemspec +38 -20
  10. data/vendor/assets/javascripts/jquery.timeago.js +5 -4
  11. data/vendor/assets/javascripts/locales/jquery.timeago.af.js +30 -20
  12. data/vendor/assets/javascripts/locales/jquery.timeago.am.js +30 -0
  13. data/vendor/assets/javascripts/locales/jquery.timeago.ar.js +12 -4
  14. data/vendor/assets/javascripts/locales/jquery.timeago.az-short.js +30 -20
  15. data/vendor/assets/javascripts/locales/jquery.timeago.az.js +30 -20
  16. data/vendor/assets/javascripts/locales/jquery.timeago.be.js +43 -0
  17. data/vendor/assets/javascripts/locales/jquery.timeago.bg.js +28 -18
  18. data/vendor/assets/javascripts/locales/jquery.timeago.bs.js +13 -7
  19. data/vendor/assets/javascripts/locales/jquery.timeago.ca.js +30 -18
  20. data/vendor/assets/javascripts/locales/jquery.timeago.cs.js +34 -24
  21. data/vendor/assets/javascripts/locales/jquery.timeago.cy.js +30 -20
  22. data/vendor/assets/javascripts/locales/jquery.timeago.da.js +28 -18
  23. data/vendor/assets/javascripts/locales/jquery.timeago.de-short.js +30 -20
  24. data/vendor/assets/javascripts/locales/jquery.timeago.de.js +29 -18
  25. data/vendor/assets/javascripts/locales/jquery.timeago.dv.js +32 -22
  26. data/vendor/assets/javascripts/locales/jquery.timeago.el.js +28 -18
  27. data/vendor/assets/javascripts/locales/jquery.timeago.en-short.js +30 -20
  28. data/vendor/assets/javascripts/locales/jquery.timeago.eo.js +30 -0
  29. data/vendor/assets/javascripts/locales/jquery.timeago.es-short.js +31 -20
  30. data/vendor/assets/javascripts/locales/jquery.timeago.es.js +29 -18
  31. data/vendor/assets/javascripts/locales/jquery.timeago.et.js +28 -18
  32. data/vendor/assets/javascripts/locales/jquery.timeago.eu.js +28 -17
  33. data/vendor/assets/javascripts/locales/jquery.timeago.fa-short.js +30 -20
  34. data/vendor/assets/javascripts/locales/jquery.timeago.fa.js +32 -22
  35. data/vendor/assets/javascripts/locales/jquery.timeago.fi.js +38 -28
  36. data/vendor/assets/javascripts/locales/jquery.timeago.fr-short.js +26 -16
  37. data/vendor/assets/javascripts/locales/jquery.timeago.fr.js +27 -17
  38. data/vendor/assets/javascripts/locales/jquery.timeago.gl.js +28 -18
  39. data/vendor/assets/javascripts/locales/jquery.timeago.he.js +26 -16
  40. data/vendor/assets/javascripts/locales/jquery.timeago.hr.js +53 -48
  41. data/vendor/assets/javascripts/locales/jquery.timeago.hu.js +28 -18
  42. data/vendor/assets/javascripts/locales/jquery.timeago.hy.js +28 -18
  43. data/vendor/assets/javascripts/locales/jquery.timeago.id.js +29 -18
  44. data/vendor/assets/javascripts/locales/jquery.timeago.is.js +29 -19
  45. data/vendor/assets/javascripts/locales/jquery.timeago.it-short.js +30 -20
  46. data/vendor/assets/javascripts/locales/jquery.timeago.it.js +28 -16
  47. data/vendor/assets/javascripts/locales/jquery.timeago.ja.js +29 -19
  48. data/vendor/assets/javascripts/locales/jquery.timeago.jv.js +28 -18
  49. data/vendor/assets/javascripts/locales/jquery.timeago.ka.js +30 -0
  50. data/vendor/assets/javascripts/locales/jquery.timeago.ko.js +31 -20
  51. data/vendor/assets/javascripts/locales/jquery.timeago.ky.js +11 -3
  52. data/vendor/assets/javascripts/locales/jquery.timeago.lt.js +30 -20
  53. data/vendor/assets/javascripts/locales/jquery.timeago.lv.js +30 -20
  54. data/vendor/assets/javascripts/locales/jquery.timeago.mk.js +30 -20
  55. data/vendor/assets/javascripts/locales/jquery.timeago.nl.js +30 -20
  56. data/vendor/assets/javascripts/locales/jquery.timeago.no.js +28 -18
  57. data/vendor/assets/javascripts/locales/jquery.timeago.pl.js +11 -3
  58. data/vendor/assets/javascripts/locales/jquery.timeago.pt-br-short.js +30 -20
  59. data/vendor/assets/javascripts/locales/jquery.timeago.pt-br.js +28 -18
  60. data/vendor/assets/javascripts/locales/jquery.timeago.pt-short.js +30 -20
  61. data/vendor/assets/javascripts/locales/jquery.timeago.pt.js +26 -16
  62. data/vendor/assets/javascripts/locales/jquery.timeago.ro.js +29 -18
  63. data/vendor/assets/javascripts/locales/jquery.timeago.rs.js +53 -48
  64. data/vendor/assets/javascripts/locales/jquery.timeago.ru.js +13 -4
  65. data/vendor/assets/javascripts/locales/jquery.timeago.rw.js +30 -20
  66. data/vendor/assets/javascripts/locales/jquery.timeago.si.js +28 -18
  67. data/vendor/assets/javascripts/locales/jquery.timeago.sk.js +34 -18
  68. data/vendor/assets/javascripts/locales/jquery.timeago.sl.js +45 -39
  69. data/vendor/assets/javascripts/locales/jquery.timeago.sq.js +26 -0
  70. data/vendor/assets/javascripts/locales/jquery.timeago.sr.js +53 -48
  71. data/vendor/assets/javascripts/locales/jquery.timeago.sv.js +28 -18
  72. data/vendor/assets/javascripts/locales/jquery.timeago.th.js +30 -20
  73. data/vendor/assets/javascripts/locales/jquery.timeago.tr-short.js +30 -20
  74. data/vendor/assets/javascripts/locales/jquery.timeago.tr.js +26 -16
  75. data/vendor/assets/javascripts/locales/jquery.timeago.uk.js +11 -3
  76. data/vendor/assets/javascripts/locales/jquery.timeago.ur.js +30 -0
  77. data/vendor/assets/javascripts/locales/jquery.timeago.uz.js +29 -19
  78. data/vendor/assets/javascripts/locales/jquery.timeago.vi.js +30 -20
  79. data/vendor/assets/javascripts/locales/jquery.timeago.zh-CN.js +31 -20
  80. data/vendor/assets/javascripts/locales/jquery.timeago.zh-TW.js +30 -20
  81. metadata +20 -21
  82. data/.gitignore +0 -22
  83. data/.travis.yml +0 -10
  84. data/Gemfile +0 -18
  85. data/Rakefile +0 -45
  86. data/spec/rails-timeago_spec.rb +0 -44
  87. data/spec/spec_helper.rb +0 -25
  88. data/spec/support/assets/javascripts/jquery.js +0 -4
  89. data/spec/support/stub.rb +0 -87
  90. data/spec/timeago/helper_spec.rb +0 -208
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 52c588e6702f5ed8be2688fa204b41e66b626cae
4
- data.tar.gz: 50facebfe354668e18cbe509b809091498e02a6a
2
+ SHA256:
3
+ metadata.gz: d2f04682a7ba3fcb6eb2600fe9cc15a824ad2402be862b744f249a77cf7bf2c0
4
+ data.tar.gz: e2e4b06684047da1b141325b377acebe0e4925e4a6dafd0e5045e10e43886ede
5
5
  SHA512:
6
- metadata.gz: ca5c71b745ff0a0e5c0a3d6d6b85a38fd2b1f6a25f8b3c8b832e72be4caa4a3568040d2586cac0a312b14a429462a7967aa192b67e00bdf9a9da4d466ba878d4
7
- data.tar.gz: c175013070da3d694d1681b2bca2f1ba01e7c6c82cc240b07721785c24f6ee0f388d5c0de5b64e80fd7a424913ffe0cc171507733dc4d74086eac6b24e0d4372
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 derpecated "ready" event (compatible with jQuery 3.0) (#40)
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://badge.fury.io/rb/rails-timeago.svg)](http://badge.fury.io/rb/rails-timeago)
4
- [![Build Status](https://travis-ci.org/jgraichen/rails-timeago.svg?branch=master)](https://travis-ci.org/jgraichen/rails-timeago)
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, :nojs => true, :limit => 10.days.ago %>
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, :format => options[:format] }`)
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 :limit => proc { 20.days.ago }, :nojs => true
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, :lang => :de %>
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
@@ -8,5 +8,5 @@
8
8
  $('time[data-time-ago]').timeago();
9
9
  };
10
10
  $(fn);
11
- $(document).on('turbolinks:load page:load ajax:success', fn);
11
+ $(document).on('turbolinks:load page:load ajax:success ajaxSuccess', fn);
12
12
  })(jQuery);
data/lib/rails-timeago.rb CHANGED
@@ -1,11 +1,13 @@
1
- require "rails-timeago/version"
2
- require "rails-timeago/helper"
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', :group => :all do |app|
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 given
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 be converted.
38
- # Global limit should be given as a block to reevaluate limit each time timeago_tag is called.
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 ||= self.option_hash
53
+ @defaults ||= option_hash
51
54
  if opts
52
- @defaults.merge! opts.extract!(*@defaults.keys.select{|k| opts.include?(k)})
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 = self.option_hash
64
+ @defaults = option_hash
61
65
  end
62
66
 
63
67
  def self.option_hash
64
68
  {
65
- :nojs => false,
66
- :force => false,
67
- :format => :default,
68
- :limit => proc { 4.days.ago },
69
- :date_only => true,
70
- :default => '-',
71
- :title => proc { |time, options| I18n.l time, :format => options[:format] }
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
@@ -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" title="Sat, 10 Mar 2012 12:07:07 +0100" data-time-ago="2012-03-10T12:07:07+01:00">2012-03-10</time>"
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 will not be converted.
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{|k| html_options.include?(k)})
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.merge! :title => time_options[:title].is_a?(Proc) ? time_options[:title].call(time, time_options) : time_options[:title]
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] or time_range.nil? or time_range.cover?(time)
59
- html_options.merge!('data-time-ago' => time.iso8601)
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 if time_options[:date_only]
66
- return time_ago_in_words(time) if time_options[:nojs] and (time_options[:limit].nil? or time_options[:limit] < time)
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, :format => time_options[:format]
84
+ I18n.l time, format: time_options[:format]
69
85
  end
70
86
 
71
87
  # Return a JavaScript tag to set jQuery timeago locale.
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rails
2
4
  module Timeago
3
5
  module VERSION
4
6
  MAJOR = 2
5
- MINOR = 15
6
- PATCH = 0
7
+ MINOR = 19
8
+ PATCH = 1
7
9
  STAGE = nil
8
10
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.').freeze
9
11
 
@@ -1,21 +1,39 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/rails-timeago/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Jan Graichen"]
6
- gem.email = ["jan.graichen@altimos.de"]
7
- gem.description = %q{jQuery Timeago helper for Rails 3}
8
- gem.summary = %q{A Rails Helper to create time tags usable for jQuery Timeago plugin}
9
- gem.homepage = "https://github.com/jgraichen/rails-timeago"
10
- gem.license = 'MIT'
11
-
12
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
- gem.files = `git ls-files`.split("\n").reject{|file| file =~ /^scripts/}
14
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- gem.name = "rails-timeago"
16
- gem.require_paths = ["lib"]
17
- gem.version = Rails::Timeago::VERSION
18
-
19
- gem.add_dependency "activesupport", ">= 3.1"
20
- gem.add_dependency "actionpack", ">= 3.1"
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.5.3
7
- * @requires jQuery v1.2.3+
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-2015, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
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: 'any moment now',
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;