rails-timeago 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +5 -0
- data/README.md +1 -1
- data/lib/rails-timeago/version.rb +2 -2
- data/vendor/assets/javascripts/jquery.timeago.js +27 -8
- data/vendor/assets/javascripts/locales/jquery.timeago.ja.js +11 -11
- metadata +13 -12
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# rails-timeago
|
1
|
+
# rails-timeago [![Build Status](https://travis-ci.org/jgraichen/rails-timeago.png?branch=master)](https://travis-ci.org/jgraichen/rails-timeago) [![Code Climate](https://codeclimate.com/github/jgraichen/rails-timeago.png)](https://codeclimate.com/github/jgraichen/rails-timeago)
|
2
2
|
|
3
3
|
**rails-timeago** provides a timeago_tag helper to create time tags usable for
|
4
4
|
[jQuery Timeago](https://github.com/rmm5t/jquery-timeago) plugin.
|
@@ -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.0
|
6
|
+
* @version 1.1.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
|
@@ -118,15 +118,34 @@
|
|
118
118
|
}
|
119
119
|
});
|
120
120
|
|
121
|
-
|
122
|
-
|
123
|
-
|
121
|
+
// functions that can be called via $(el).timeago('action')
|
122
|
+
// init is default when no action is given
|
123
|
+
// functions are called with context of a single element
|
124
|
+
var functions = {
|
125
|
+
init: function(){
|
126
|
+
var refresh_el = $.proxy(refresh, this);
|
127
|
+
refresh_el();
|
128
|
+
var $s = $t.settings;
|
129
|
+
if ($s.refreshMillis > 0) {
|
130
|
+
setInterval(refresh_el, $s.refreshMillis);
|
131
|
+
}
|
132
|
+
},
|
133
|
+
update: function(time){
|
134
|
+
$(this).data('timeago', { datetime: $t.parse(time) });
|
135
|
+
refresh.apply(this);
|
136
|
+
}
|
137
|
+
};
|
124
138
|
|
125
|
-
|
126
|
-
|
127
|
-
|
139
|
+
$.fn.timeago = function(action, options) {
|
140
|
+
var fn = action ? functions[action] : functions.init;
|
141
|
+
if(!fn){
|
142
|
+
throw new Error("Unknown function name '"+ action +"' for timeago");
|
128
143
|
}
|
129
|
-
|
144
|
+
// each over objects here and call the requested function
|
145
|
+
this.each(function(){
|
146
|
+
fn.call(this, options);
|
147
|
+
});
|
148
|
+
return this;
|
130
149
|
};
|
131
150
|
|
132
151
|
function refresh() {
|
@@ -4,16 +4,16 @@ jQuery.timeago.settings.strings["ja"] = {
|
|
4
4
|
prefixFromNow: "今から",
|
5
5
|
suffixAgo: "前",
|
6
6
|
suffixFromNow: "後",
|
7
|
-
seconds: "
|
8
|
-
minute: "
|
7
|
+
seconds: "1 分未満",
|
8
|
+
minute: "約 1 分",
|
9
9
|
minutes: "%d 分",
|
10
|
-
hour: "
|
11
|
-
hours: "
|
12
|
-
day: "
|
13
|
-
days: "%d
|
14
|
-
month: "
|
15
|
-
months: "%d
|
16
|
-
year: "1
|
17
|
-
years: "%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
18
|
wordSeparator: ""
|
19
|
-
};
|
19
|
+
};
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-timeago
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.1'
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '3.1'
|
38
38
|
type: :runtime
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '3.1'
|
46
46
|
- !ruby/object:Gem::Dependency
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
type: :development
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
description: jQuery Timeago helper for Rails 3
|
@@ -67,6 +67,7 @@ extensions: []
|
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
69
|
- .gitignore
|
70
|
+
- .travis.yml
|
70
71
|
- Gemfile
|
71
72
|
- LICENSE
|
72
73
|
- README.md
|
@@ -129,21 +130,21 @@ require_paths:
|
|
129
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
131
|
none: false
|
131
132
|
requirements:
|
132
|
-
- -
|
133
|
+
- - '>='
|
133
134
|
- !ruby/object:Gem::Version
|
134
135
|
version: '0'
|
135
136
|
segments:
|
136
137
|
- 0
|
137
|
-
hash:
|
138
|
+
hash: 288749705426603792
|
138
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
140
|
none: false
|
140
141
|
requirements:
|
141
|
-
- -
|
142
|
+
- - '>='
|
142
143
|
- !ruby/object:Gem::Version
|
143
144
|
version: '0'
|
144
145
|
segments:
|
145
146
|
- 0
|
146
|
-
hash:
|
147
|
+
hash: 288749705426603792
|
147
148
|
requirements: []
|
148
149
|
rubyforge_project:
|
149
150
|
rubygems_version: 1.8.25
|