rails-timeago 2.8.1 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4af766feda7af8b74dc42a3e1fe0811223b96922
4
- data.tar.gz: 5ff1c8eebfc68ea05c509d09d44d628565afe5a1
3
+ metadata.gz: f5d941da1caf43169e63ec9f60eb39d62944c400
4
+ data.tar.gz: 8999cb11c165d2476f3f9be8876c146c4030810b
5
5
  SHA512:
6
- metadata.gz: 494b8fc6f112410f4721eafc4695e40721d641473d0784a1480a430b32dd432a4de1a2bf74a49ca79aba95408a906321ed03e1109cbee3283388b222ef42b3f9
7
- data.tar.gz: 98e1e39c2bdb19b09433c3cc29727bb16b432527d1e5ce886fbcf3dca2fc5e87a0702cd484a449cf8ff0536cd75d0018063fe7be25fb741e5bfa173125a02d4a
6
+ metadata.gz: 03bb5efa3e4004a110617651ebbfa328f138fc1f4a2bdf0367643522b84c231e83f3b6f4fe4b12d350c5231b49c26efbb729c4790c2ee2471d5993add0c081b1
7
+ data.tar.gz: 1584e598999e31124e6015943e619d90fcd16462b8ff6e72be3821a922842265d86c270f420d7bf348a37e545d7e338aa469aef05f60c4657b1b5d32b2198e77
data/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.1.0
4
+ - rbx
3
5
  - 2.0.0
4
6
  - jruby
5
7
  - 1.9.3
data/Gemfile CHANGED
@@ -6,3 +6,5 @@ gemspec
6
6
  group :development do
7
7
  gem "rake"
8
8
  end
9
+
10
+ gem 'rubysl', platform: :rbx
@@ -4,8 +4,8 @@
4
4
  //= require locales/jquery.timeago.bg.js
5
5
  //= require locales/jquery.timeago.bs.js
6
6
  //= require locales/jquery.timeago.ca.js
7
+ //= require locales/jquery.timeago.cs.js
7
8
  //= require locales/jquery.timeago.cy.js
8
- //= require locales/jquery.timeago.cz.js
9
9
  //= require locales/jquery.timeago.da.js
10
10
  //= require locales/jquery.timeago.de.js
11
11
  //= require locales/jquery.timeago.el.js
@@ -44,5 +44,6 @@
44
44
  //= require locales/jquery.timeago.tr.js
45
45
  //= require locales/jquery.timeago.uk.js
46
46
  //= require locales/jquery.timeago.uz.js
47
+ //= require locales/jquery.timeago.vi.js
47
48
  //= require locales/jquery.timeago.zh-CN.js
48
49
  //= require locales/jquery.timeago.zh-TW.js
@@ -5,8 +5,6 @@
5
5
 
6
6
  (function($) {
7
7
  $(document).on('ready page:load', function() {
8
- $('time[data-time-ago]').each(function() {
9
- $(this).timeago();
10
- });
8
+ $('time[data-time-ago]').timeago();
11
9
  });
12
10
  })(jQuery);
@@ -2,8 +2,8 @@ module Rails
2
2
  module Timeago
3
3
  module VERSION
4
4
  MAJOR = 2
5
- MINOR = 8
6
- PATCH = 1
5
+ MINOR = 9
6
+ PATCH = 0
7
7
  STAGE = nil
8
8
 
9
9
  def self.to_s
@@ -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.3.1
6
+ * @version 1.4.0
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
@@ -39,31 +39,40 @@
39
39
  $.extend($.timeago, {
40
40
  settings: {
41
41
  refreshMillis: 60000,
42
+ allowPast: true,
42
43
  allowFuture: false,
43
44
  localeTitle: false,
44
45
  cutoff: 0,
45
46
  lang: "en",
46
- strings: { "en": {
47
- prefixAgo: null,
48
- prefixFromNow: null,
49
- suffixAgo: "ago",
50
- suffixFromNow: "from now",
51
- seconds: "less than a minute",
52
- minute: "about a minute",
53
- minutes: "%d minutes",
54
- hour: "about an hour",
55
- hours: "about %d hours",
56
- day: "a day",
57
- days: "%d days",
58
- month: "about a month",
59
- months: "%d months",
60
- year: "about a year",
61
- years: "%d years",
62
- wordSeparator: " ",
63
- numbers: []
64
- }}
47
+ strings: {
48
+ "en": {
49
+ prefixAgo: null,
50
+ prefixFromNow: null,
51
+ suffixAgo: "ago",
52
+ suffixFromNow: "from now",
53
+ inPast: 'any moment now',
54
+ seconds: "less than a minute",
55
+ minute: "about a minute",
56
+ minutes: "%d minutes",
57
+ hour: "about an hour",
58
+ hours: "about %d hours",
59
+ day: "a day",
60
+ days: "%d days",
61
+ month: "about a month",
62
+ months: "%d months",
63
+ year: "about a year",
64
+ years: "%d years",
65
+ wordSeparator: " ",
66
+ numbers: []
67
+ }
68
+ }
65
69
  },
70
+
66
71
  inWords: function(distanceMillis, lang) {
72
+ if(!this.settings.allowPast && ! this.settings.allowFuture) {
73
+ throw 'timeago allowPast and allowFuture settings can not both be set to false.';
74
+ }
75
+
67
76
  var $l = this.settings.strings[lang] || this.settings.strings[this.settings.lang] || this.settings.strings["en"];
68
77
  var prefix = $l.prefixAgo;
69
78
  var suffix = $l.suffixAgo;
@@ -74,6 +83,10 @@
74
83
  }
75
84
  }
76
85
 
86
+ if(!this.settings.allowPast && distanceMillis >= 0) {
87
+ return this.settings.strings.inPast;
88
+ }
89
+
77
90
  var seconds = Math.abs(distanceMillis) / 1000;
78
91
  var minutes = seconds / 60;
79
92
  var hours = minutes / 60;
@@ -102,6 +115,7 @@
102
115
  if ($l.wordSeparator === undefined) { separator = " "; }
103
116
  return $.trim([prefix, words, suffix].join(separator));
104
117
  },
118
+
105
119
  parse: function(iso8601) {
106
120
  var s = $.trim(iso8601);
107
121
  s = s.replace(/\.\d+/,""); // remove milliseconds
@@ -1,5 +1,5 @@
1
1
  // Czech
2
- jQuery.timeago.settings.strings["cz"] = {
2
+ jQuery.timeago.settings.strings["cs"] = {
3
3
  prefixAgo: "před",
4
4
  prefixFromNow: null,
5
5
  suffixAgo: null,
@@ -0,0 +1,20 @@
1
+ // Vietnamese
2
+ jQuery.timeago.settings.strings["vi"] = {
3
+ prefixAgo: 'cách đây',
4
+ prefixFromNow: null,
5
+ suffixAgo: null,
6
+ suffixFromNow: "trước",
7
+ seconds: "chưa đến một phút",
8
+ minute: "khoảng một phút",
9
+ minutes: "%d phút",
10
+ hour: "khoảng một tiếng",
11
+ hours: "khoảng %d tiếng",
12
+ day: "một ngày",
13
+ days: "%d ngày",
14
+ month: "khoảng một tháng",
15
+ months: "%d tháng",
16
+ year: "khoảng một năm",
17
+ years: "%d năm",
18
+ wordSeparator: " ",
19
+ numbers: []
20
+ };
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-timeago
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 2.9.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: 2013-12-29 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: jQuery Timeago helper for Rails 3
@@ -59,8 +59,8 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
63
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
64
  - Gemfile
65
65
  - LICENSE
66
66
  - README.md
@@ -79,8 +79,8 @@ files:
79
79
  - vendor/assets/javascripts/locales/jquery.timeago.bg.js
80
80
  - vendor/assets/javascripts/locales/jquery.timeago.bs.js
81
81
  - vendor/assets/javascripts/locales/jquery.timeago.ca.js
82
+ - vendor/assets/javascripts/locales/jquery.timeago.cs.js
82
83
  - vendor/assets/javascripts/locales/jquery.timeago.cy.js
83
- - vendor/assets/javascripts/locales/jquery.timeago.cz.js
84
84
  - vendor/assets/javascripts/locales/jquery.timeago.da.js
85
85
  - vendor/assets/javascripts/locales/jquery.timeago.de.js
86
86
  - vendor/assets/javascripts/locales/jquery.timeago.el.js
@@ -119,6 +119,7 @@ files:
119
119
  - vendor/assets/javascripts/locales/jquery.timeago.tr.js
120
120
  - vendor/assets/javascripts/locales/jquery.timeago.uk.js
121
121
  - vendor/assets/javascripts/locales/jquery.timeago.uz.js
122
+ - vendor/assets/javascripts/locales/jquery.timeago.vi.js
122
123
  - vendor/assets/javascripts/locales/jquery.timeago.zh-CN.js
123
124
  - vendor/assets/javascripts/locales/jquery.timeago.zh-TW.js
124
125
  homepage: https://github.com/jgraichen/rails-timeago
@@ -131,17 +132,17 @@ require_paths:
131
132
  - lib
132
133
  required_ruby_version: !ruby/object:Gem::Requirement
133
134
  requirements:
134
- - - '>='
135
+ - - ">="
135
136
  - !ruby/object:Gem::Version
136
137
  version: '0'
137
138
  required_rubygems_version: !ruby/object:Gem::Requirement
138
139
  requirements:
139
- - - '>='
140
+ - - ">="
140
141
  - !ruby/object:Gem::Version
141
142
  version: '0'
142
143
  requirements: []
143
144
  rubyforge_project:
144
- rubygems_version: 2.1.11
145
+ rubygems_version: 2.2.2
145
146
  signing_key:
146
147
  specification_version: 4
147
148
  summary: A Rails Helper to create time tags usable for jQuery Timeago plugin