rails-timeago 2.13.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8201662e2e5817c4cbaec5865cb4f83588440cb9
4
- data.tar.gz: 1220cf40d7a81f5b27d2d286163733fa1254d58e
3
+ metadata.gz: d3b70af4baab360c1b875e4befe0cbfbc37150f1
4
+ data.tar.gz: e019a05591543be2575f99b63513a32c6c753ddc
5
5
  SHA512:
6
- metadata.gz: 183dc19991a52c8997ea1f6ef32e4532da19b79d278203802020d75b9358e4c7c5d4e1eb08ad7a51384d1f4bb5dff9bc37f93c1080f2023e2e0ac11f5b408b90
7
- data.tar.gz: d0ff04c180a3c0b33ff3a04e804cc6dbd5bb28f1e03854f96a2bfe71c95fb2adfbc1453e30c4441c39337451effb1fd07ef90f3aad400083568de6c49b8bd887
6
+ metadata.gz: b186f571498592c5fbaad53e5a0da60cdabbd14b32859dd850136847eb60db66fc6a9d274d97f2c8e5588a4a6722eea9d280884eec4fd525bfe7b5e85192df54
7
+ data.tar.gz: 190adb567aae0f61fe61353f747662478be56ff59335a2bb22bfaaacefdbd0ca7623603645ea869387211889b80c8fe34f92d7c1cec49bc799aa09f47effc57b
data/.travis.yml CHANGED
@@ -1,8 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - '2.3.0'
3
4
  - '2.2'
4
5
  - '2.1'
5
- - 'rbx-2'
6
6
  - '2.0'
7
- - 'jruby'
8
7
  - '1.9.3'
8
+ - 'rbx-2'
9
+ - 'jruby'
10
+ before_install:
11
+ - gem install bundler
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.14.0
4
+
5
+ * Update jquery-timeago and locales from upstream
6
+ * Add turbolinks5 event (#36)
7
+
3
8
  ## 2.13.0
4
9
 
5
10
  * Update jquery-timeago and locales from upstream
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # rails-timeago
2
2
 
3
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.png?branch=master)](https://travis-ci.org/jgraichen/rails-timeago)
5
- [![Code Climate](https://codeclimate.com/github/jgraichen/rails-timeago.png)](https://codeclimate.com/github/jgraichen/rails-timeago)
6
- [![Dependency Status](https://gemnasium.com/jgraichen/rails-timeago.png)](https://gemnasium.com/jgraichen/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)
7
7
 
8
8
  **rails-timeago** provides a timeago_tag helper to create time tags usable for
9
9
  [jQuery Timeago](https://github.com/rmm5t/jquery-timeago) plugin.
@@ -8,6 +8,7 @@
8
8
  //= require locales/jquery.timeago.cs.js
9
9
  //= require locales/jquery.timeago.cy.js
10
10
  //= require locales/jquery.timeago.da.js
11
+ //= require locales/jquery.timeago.de-short.js
11
12
  //= require locales/jquery.timeago.de.js
12
13
  //= require locales/jquery.timeago.dv.js
13
14
  //= require locales/jquery.timeago.el.js
@@ -15,6 +16,8 @@
15
16
  //= require locales/jquery.timeago.es-short.js
16
17
  //= require locales/jquery.timeago.es.js
17
18
  //= require locales/jquery.timeago.et.js
19
+ //= require locales/jquery.timeago.eu.js
20
+ //= require locales/jquery.timeago.fa-short.js
18
21
  //= require locales/jquery.timeago.fa.js
19
22
  //= require locales/jquery.timeago.fi.js
20
23
  //= require locales/jquery.timeago.fr-short.js
@@ -33,6 +36,7 @@
33
36
  //= require locales/jquery.timeago.ko.js
34
37
  //= require locales/jquery.timeago.ky.js
35
38
  //= require locales/jquery.timeago.lt.js
39
+ //= require locales/jquery.timeago.lv.js
36
40
  //= require locales/jquery.timeago.mk.js
37
41
  //= require locales/jquery.timeago.nl.js
38
42
  //= require locales/jquery.timeago.no.js
@@ -48,8 +52,10 @@
48
52
  //= require locales/jquery.timeago.si.js
49
53
  //= require locales/jquery.timeago.sk.js
50
54
  //= require locales/jquery.timeago.sl.js
55
+ //= require locales/jquery.timeago.sr.js
51
56
  //= require locales/jquery.timeago.sv.js
52
57
  //= require locales/jquery.timeago.th.js
58
+ //= require locales/jquery.timeago.tr-short.js
53
59
  //= require locales/jquery.timeago.tr.js
54
60
  //= require locales/jquery.timeago.uk.js
55
61
  //= require locales/jquery.timeago.uz.js
@@ -4,7 +4,7 @@
4
4
  //= require jquery.timeago
5
5
 
6
6
  (function($) {
7
- $(document).on('ready page:load ajax:success', function() {
7
+ $(document).on('ready turbolinks:load page:load ajax:success', function() {
8
8
  $('time[data-time-ago]').timeago();
9
9
  });
10
10
  })(jQuery);
@@ -2,12 +2,13 @@ module Rails
2
2
  module Timeago
3
3
  module VERSION
4
4
  MAJOR = 2
5
- MINOR = 13
5
+ MINOR = 14
6
6
  PATCH = 0
7
7
  STAGE = nil
8
+ STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.').freeze
8
9
 
9
10
  def self.to_s
10
- [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join '.'
11
+ STRING
11
12
  end
12
13
  end
13
14
  end
@@ -3,7 +3,7 @@
3
3
  * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
4
4
  *
5
5
  * @name timeago
6
- * @version 1.4.3
6
+ * @version 1.5.2
7
7
  * @requires jQuery v1.2.3+
8
8
  * @author Ryan McGeary
9
9
  * @license MIT License - http://www.opensource.org/licenses/mit-license.php
@@ -45,9 +45,10 @@
45
45
  allowFuture: false,
46
46
  localeTitle: false,
47
47
  cutoff: 0,
48
+ autoDispose: true,
48
49
  lang: "en",
49
50
  strings: {
50
- "en": {
51
+ en: {
51
52
  prefixAgo: null,
52
53
  prefixFromNow: null,
53
54
  suffixAgo: "ago",
@@ -71,7 +72,7 @@
71
72
  },
72
73
 
73
74
  inWords: function(distanceMillis, lang) {
74
- if(!this.settings.allowPast && ! this.settings.allowFuture) {
75
+ if (!this.settings.allowPast && ! this.settings.allowFuture) {
75
76
  throw 'timeago allowPast and allowFuture settings can not both be set to false.';
76
77
  }
77
78
 
@@ -85,8 +86,8 @@
85
86
  }
86
87
  }
87
88
 
88
- if(!this.settings.allowPast && distanceMillis >= 0) {
89
- return this.settings.strings[lang].inPast;
89
+ if (!this.settings.allowPast && distanceMillis >= 0) {
90
+ return $l.inPast;
90
91
  }
91
92
 
92
93
  var seconds = Math.abs(distanceMillis) / 1000;
@@ -141,7 +142,7 @@
141
142
  // init is default when no action is given
142
143
  // functions are called with context of a single element
143
144
  var functions = {
144
- init: function(){
145
+ init: function() {
145
146
  var refresh_el = $.proxy(refresh, this);
146
147
  refresh_el();
147
148
  var $s = $t.settings;
@@ -149,13 +150,13 @@
149
150
  this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
150
151
  }
151
152
  },
152
- update: function(time){
153
- var parsedTime = $t.parse(time);
154
- $(this).data('timeago', { datetime: parsedTime });
155
- if($t.settings.localeTitle) $(this).attr("title", parsedTime.toLocaleString());
153
+ update: function(timestamp) {
154
+ var date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp);
155
+ $(this).data('timeago', { datetime: date });
156
+ if ($t.settings.localeTitle) $(this).attr("title", date.toLocaleString());
156
157
  refresh.apply(this);
157
158
  },
158
- updateFromDOM: function(){
159
+ updateFromDOM: function() {
159
160
  $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) });
160
161
  refresh.apply(this);
161
162
  },
@@ -169,26 +170,27 @@
169
170
 
170
171
  $.fn.timeago = function(action, options) {
171
172
  var fn = action ? functions[action] : functions.init;
172
- if(!fn){
173
+ if (!fn) {
173
174
  throw new Error("Unknown function name '"+ action +"' for timeago");
174
175
  }
175
176
  // each over objects here and call the requested function
176
- this.each(function(){
177
+ this.each(function() {
177
178
  fn.call(this, options);
178
179
  });
179
180
  return this;
180
181
  };
181
182
 
182
183
  function refresh() {
184
+ var $s = $t.settings;
185
+
183
186
  //check if it's still visible
184
- if(!$.contains(document.documentElement,this)){
187
+ if ($s.autoDispose && !$.contains(document.documentElement,this)) {
185
188
  //stop if it has been removed
186
189
  $(this).timeago("dispose");
187
190
  return this;
188
191
  }
189
192
 
190
193
  var data = prepareData(this);
191
- var $s = $t.settings;
192
194
 
193
195
  if (!isNaN(data.datetime)) {
194
196
  if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
@@ -0,0 +1,20 @@
1
+ // German shortened
2
+ jQuery.timeago.settings.strings["de-short"] = {
3
+ prefixAgo: null,
4
+ prefixFromNow: null,
5
+ suffixAgo: "",
6
+ suffixFromNow: "",
7
+ seconds: "s",
8
+ minute: "1m",
9
+ minutes: "%dm",
10
+ hour: "1h",
11
+ hours: "%dh",
12
+ day: "1T.",
13
+ days: "%dT.",
14
+ month: "1Mt.",
15
+ months: "%dMt.",
16
+ year: "1J.",
17
+ years: "%dJ.",
18
+ wordSeparator: " ",
19
+ numbers: []
20
+ };
@@ -0,0 +1,17 @@
1
+ jQuery.timeago.settings.strings["eu"] = {
2
+ prefixAgo: "duela",
3
+ prefixFromNow: "hemendik",
4
+ suffixAgo: "",
5
+ suffixFromNow: "barru",
6
+ seconds: "minutu bat bainu gutxiago",
7
+ minute: "minutu bat",
8
+ minutes: "%d minutu inguru",
9
+ hour: "ordu bat",
10
+ hours: "%d ordu",
11
+ day: "egun bat",
12
+ days: "%d egun",
13
+ month: "hilabete bat",
14
+ months: "%d hilabete",
15
+ year: "urte bat",
16
+ years: "%d urte"
17
+ };
@@ -0,0 +1,20 @@
1
+ // persion shortened
2
+ jQuery.timeago.settings.strings["fa-short"] = {
3
+ prefixAgo: null,
4
+ prefixFromNow: null,
5
+ suffixAgo: "",
6
+ suffixFromNow: "",
7
+ seconds: "1دقیقه",
8
+ minute: "1دقیقه",
9
+ minutes: "%dدقیقه",
10
+ hour: "1ساعت",
11
+ hours: "%dساعت",
12
+ day: "1روز",
13
+ days: "%dروز",
14
+ month: "1ماه",
15
+ months: "%dماه",
16
+ year: "1سال",
17
+ years: "%dسال",
18
+ wordSeparator: " ",
19
+ numbers: []
20
+ };
@@ -11,8 +11,8 @@ jQuery.timeago.settings.strings["ja"] = {
11
11
  hours: "約 %d 時間",
12
12
  day: "約 1 日",
13
13
  days: "約 %d 日",
14
- month: "約 1 ",
15
- months: "約 %d ",
14
+ month: "約 1 ヶ月",
15
+ months: "約 %d ヶ月",
16
16
  year: "約 1 年",
17
17
  years: "約 %d 年",
18
18
  wordSeparator: ""
@@ -0,0 +1,20 @@
1
+ //Latvian
2
+ jQuery.timeago.settings.strings["lv"] = {
3
+ prefixAgo: "pirms",
4
+ prefixFromNow: null,
5
+ suffixAgo: null,
6
+ suffixFromNow: "no šī brīža",
7
+ seconds: "%d sek.",
8
+ minute: "min.",
9
+ minutes: "%d min.",
10
+ hour: "st.",
11
+ hours: "%d st.",
12
+ day: "1 d.",
13
+ days: "%d d.",
14
+ month: "mēnesis.",
15
+ months: "%d mēnesis.",
16
+ year: "gads",
17
+ years: "%d gads",
18
+ wordSeparator: " ",
19
+ numbers: []
20
+ };
@@ -28,7 +28,7 @@
28
28
  },
29
29
  month: "en mesec",
30
30
  months: function (value) {
31
- return numpf(value, ["%d mescov", "%d mesec", "%d mesca", "%d mesce"]);
31
+ return numpf(value, ["%d mesecev", "%d mesec", "%d meseca", "%d mesece"]);
32
32
  },
33
33
  year: "eno leto",
34
34
  years: function (value) {
@@ -0,0 +1,49 @@
1
+ // Serbian
2
+ (function () {
3
+ var numpf;
4
+
5
+ numpf = function (n, f, s, t) {
6
+ var n10;
7
+ n10 = n % 10;
8
+ if (n10 === 1 && (n === 1 || n > 20)) {
9
+ return f;
10
+ } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) {
11
+ return s;
12
+ } else {
13
+ return t;
14
+ }
15
+ };
16
+
17
+ jQuery.timeago.settings.strings["sr"] = {
18
+ prefixAgo: "пре",
19
+ prefixFromNow: "за",
20
+ suffixAgo: null,
21
+ suffixFromNow: null,
22
+ second: "секунд",
23
+ seconds: function (value) {
24
+ return numpf(value, "%d секунд", "%d секунде", "%d секунди");
25
+ },
26
+ minute: "један минут",
27
+ minutes: function (value) {
28
+ return numpf(value, "%d минут", "%d минута", "%d минута");
29
+ },
30
+ hour: "један сат",
31
+ hours: function (value) {
32
+ return numpf(value, "%d сат", "%d сата", "%d сати");
33
+ },
34
+ day: "један дан",
35
+ days: function (value) {
36
+ return numpf(value, "%d дан", "%d дана", "%d дана");
37
+ },
38
+ month: "месец дана",
39
+ months: function (value) {
40
+ return numpf(value, "%d месец", "%d месеца", "%d месеци");
41
+ },
42
+ year: "годину дана",
43
+ years: function (value) {
44
+ return numpf(value, "%d годину", "%d године", "%d година");
45
+ },
46
+ wordSeparator: " "
47
+ };
48
+
49
+ }).call(this);
@@ -0,0 +1,20 @@
1
+ // Turkish shortened
2
+ jQuery.timeago.settings.strings["tr-short"] = {
3
+ prefixAgo: null,
4
+ prefixFromNow: null,
5
+ suffixAgo: "",
6
+ suffixFromNow: "",
7
+ seconds: "1sn",
8
+ minute: "1d",
9
+ minutes: "%dd",
10
+ hour: "1s",
11
+ hours: "%ds",
12
+ day: "1g",
13
+ days: "%dg",
14
+ month: "1ay",
15
+ months: "%day",
16
+ year: "1y",
17
+ years: "%dy",
18
+ wordSeparator: " ",
19
+ numbers: []
20
+ };
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-timeago
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2016-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -84,6 +84,7 @@ files:
84
84
  - vendor/assets/javascripts/locales/jquery.timeago.cs.js
85
85
  - vendor/assets/javascripts/locales/jquery.timeago.cy.js
86
86
  - vendor/assets/javascripts/locales/jquery.timeago.da.js
87
+ - vendor/assets/javascripts/locales/jquery.timeago.de-short.js
87
88
  - vendor/assets/javascripts/locales/jquery.timeago.de.js
88
89
  - vendor/assets/javascripts/locales/jquery.timeago.dv.js
89
90
  - vendor/assets/javascripts/locales/jquery.timeago.el.js
@@ -91,6 +92,8 @@ files:
91
92
  - vendor/assets/javascripts/locales/jquery.timeago.es-short.js
92
93
  - vendor/assets/javascripts/locales/jquery.timeago.es.js
93
94
  - vendor/assets/javascripts/locales/jquery.timeago.et.js
95
+ - vendor/assets/javascripts/locales/jquery.timeago.eu.js
96
+ - vendor/assets/javascripts/locales/jquery.timeago.fa-short.js
94
97
  - vendor/assets/javascripts/locales/jquery.timeago.fa.js
95
98
  - vendor/assets/javascripts/locales/jquery.timeago.fi.js
96
99
  - vendor/assets/javascripts/locales/jquery.timeago.fr-short.js
@@ -109,6 +112,7 @@ files:
109
112
  - vendor/assets/javascripts/locales/jquery.timeago.ko.js
110
113
  - vendor/assets/javascripts/locales/jquery.timeago.ky.js
111
114
  - vendor/assets/javascripts/locales/jquery.timeago.lt.js
115
+ - vendor/assets/javascripts/locales/jquery.timeago.lv.js
112
116
  - vendor/assets/javascripts/locales/jquery.timeago.mk.js
113
117
  - vendor/assets/javascripts/locales/jquery.timeago.nl.js
114
118
  - vendor/assets/javascripts/locales/jquery.timeago.no.js
@@ -124,8 +128,10 @@ files:
124
128
  - vendor/assets/javascripts/locales/jquery.timeago.si.js
125
129
  - vendor/assets/javascripts/locales/jquery.timeago.sk.js
126
130
  - vendor/assets/javascripts/locales/jquery.timeago.sl.js
131
+ - vendor/assets/javascripts/locales/jquery.timeago.sr.js
127
132
  - vendor/assets/javascripts/locales/jquery.timeago.sv.js
128
133
  - vendor/assets/javascripts/locales/jquery.timeago.th.js
134
+ - vendor/assets/javascripts/locales/jquery.timeago.tr-short.js
129
135
  - vendor/assets/javascripts/locales/jquery.timeago.tr.js
130
136
  - vendor/assets/javascripts/locales/jquery.timeago.uk.js
131
137
  - vendor/assets/javascripts/locales/jquery.timeago.uz.js
@@ -152,9 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
158
  version: '0'
153
159
  requirements: []
154
160
  rubyforge_project:
155
- rubygems_version: 2.4.8
161
+ rubygems_version: 2.6.4
156
162
  signing_key:
157
163
  specification_version: 4
158
164
  summary: A Rails Helper to create time tags usable for jQuery Timeago plugin
159
165
  test_files: []
160
- has_rdoc: