rails-timeago 2.19.1 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +8 -2
- data/lib/rails-timeago/helper.rb +2 -10
- data/lib/rails-timeago/version.rb +3 -3
- data/lib/rails-timeago.rb +1 -1
- data/rails-timeago.gemspec +8 -7
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32c4caa5aad3c864a7d9c9c1bd6a75641a4d5212fc121b069156903ff06378e3
|
4
|
+
data.tar.gz: '085ce3e027269aff9b46e3e0deed3e3198f21688fc608b5ba04ab1ffb707cd1f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eb265302466cfabac8f31eee716bc56eb62ee66e9cd1e9bf6643605ea9e1bae53eccfa6c7e5b1bb14470bf23c7619b09cc6861a4a15b2f384ef17614ccdb23a
|
7
|
+
data.tar.gz: 28149e0acd3006ebeb9e5d06a528c9fe61fe1d05630904c5727ca18f88d9427ebd30681be16f96a3b6242af5d6e422953b5c775b8507c9949fc58f5b7c434661
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
|
4
|
+
## Unreleased
|
5
|
+
---
|
6
|
+
|
7
|
+
### New
|
8
|
+
|
9
|
+
### Changes
|
10
|
+
|
11
|
+
### Fixes
|
12
|
+
|
13
|
+
### Breaks
|
14
|
+
|
15
|
+
|
16
|
+
## 2.20.0 - (2022-03-04)
|
17
|
+
|
18
|
+
### New
|
19
|
+
* Support for javascript tags nonce parameter
|
20
|
+
|
3
21
|
## 2.19.1
|
4
22
|
|
5
23
|
* Maintenance release reducing gem archive size
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# rails-timeago
|
2
2
|
|
3
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/
|
4
|
+
[![Build Status](https://img.shields.io/github/workflow/status/jgraichen/rails-timeago/test?logo=github)](https://github.com/jgraichen/rails-timeago/actions?query=workflow%3Atest+branch%3Amaster)
|
5
5
|
|
6
6
|
**rails-timeago** provides a timeago_tag helper to create time tags usable for
|
7
7
|
[jQuery Timeago](https://github.com/rmm5t/jquery-timeago) plugin.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
Add this line to your
|
11
|
+
Add this line to your `Gemfile`:
|
12
12
|
|
13
13
|
```ruby
|
14
14
|
gem 'rails-timeago', '~> 2.0'
|
@@ -22,6 +22,10 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
$ gem install rails-timeago
|
24
24
|
|
25
|
+
### Use bundled JavaScript with Sprockets
|
26
|
+
|
27
|
+
*Note:* The bundled JavaScript can only be used with sprockets. Rails-webpacker cannot load scripts bundled with the gem. If you use rails-webpacker you need to install, load, and setup jquery-timeago on your own.
|
28
|
+
|
25
29
|
To use bundled jQuery Timeago plugin add this require statement to your `application.js` file:
|
26
30
|
|
27
31
|
//= require rails-timeago
|
@@ -96,6 +100,8 @@ The following snippet will print a script tag that set the jQuery timeago locale
|
|
96
100
|
<%= timeago_script_tag %>
|
97
101
|
```
|
98
102
|
|
103
|
+
Arguments are passed to Rails' `javascript_tag` helper, e.g. to assign a CSP nonce: `timeago_script_tag(nonce: true)`.
|
104
|
+
|
99
105
|
Just insert it in your application layout's html head. If you use another I18n framework for JavaScript you can also directly set `jQuery.timeago.settings.lang`. For example:
|
100
106
|
|
101
107
|
```js
|
data/lib/rails-timeago/helper.rb
CHANGED
@@ -40,10 +40,6 @@ module Rails
|
|
40
40
|
#
|
41
41
|
# All other options will be given as options to tag helper.
|
42
42
|
#
|
43
|
-
# rubocop:disable Metrics/AbcSize
|
44
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
45
|
-
# rubocop:disable Metrics/MethodLength
|
46
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
47
43
|
def timeago_tag(time, html_options = {})
|
48
44
|
time_options = Rails::Timeago.default_options
|
49
45
|
|
@@ -70,10 +66,6 @@ module Rails
|
|
70
66
|
end
|
71
67
|
time_tag time, timeago_tag_content(time, time_options), html_options
|
72
68
|
end
|
73
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
74
|
-
# rubocop:enable Metrics/MethodLength
|
75
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
76
|
-
# rubocop:enable Metrics/AbcSize
|
77
69
|
|
78
70
|
def timeago_tag_content(time, time_options = {}) # :nodoc:
|
79
71
|
time = time.to_date if time_options[:date_only]
|
@@ -85,8 +77,8 @@ module Rails
|
|
85
77
|
end
|
86
78
|
|
87
79
|
# Return a JavaScript tag to set jQuery timeago locale.
|
88
|
-
def timeago_script_tag
|
89
|
-
javascript_tag
|
80
|
+
def timeago_script_tag(**kwargs)
|
81
|
+
javascript_tag("jQuery.timeago.settings.lang=\"#{I18n.locale}\";", **kwargs) if I18n.locale != 'en'
|
90
82
|
end
|
91
83
|
end
|
92
84
|
end
|
@@ -4,10 +4,10 @@ module Rails
|
|
4
4
|
module Timeago
|
5
5
|
module VERSION
|
6
6
|
MAJOR = 2
|
7
|
-
MINOR =
|
8
|
-
PATCH =
|
7
|
+
MINOR = 20
|
8
|
+
PATCH = 0
|
9
9
|
STAGE = nil
|
10
|
-
STRING = [MAJOR, MINOR, PATCH, STAGE].
|
10
|
+
STRING = [MAJOR, MINOR, PATCH, STAGE].compact.join('.').freeze
|
11
11
|
|
12
12
|
def self.to_s
|
13
13
|
STRING
|
data/lib/rails-timeago.rb
CHANGED
data/rails-timeago.gemspec
CHANGED
@@ -13,11 +13,10 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = 'https://github.com/jgraichen/rails-timeago'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.
|
17
|
-
|
18
|
-
spec.metadata['
|
19
|
-
spec.metadata['
|
20
|
-
spec.metadata['changelog_uri'] = 'https://github.com/jgraichen/rails-timeago/blob/master/CHANGELOG.md'
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = 'https://github.com/jgraichen/rails-timeago'
|
18
|
+
spec.metadata['changelog_uri'] = 'https://github.com/jgraichen/rails-timeago/blob/master/CHANGELOG.md'
|
19
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
21
20
|
|
22
21
|
# Specify which files should be added to the gem when it is released.
|
23
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -34,6 +33,8 @@ Gem::Specification.new do |spec|
|
|
34
33
|
spec.executables = spec.files.grep(%r{\Aexe/}) {|f| File.basename(f) }
|
35
34
|
spec.require_paths = ['lib']
|
36
35
|
|
37
|
-
spec.
|
38
|
-
|
36
|
+
spec.required_ruby_version = '>= 2.5'
|
37
|
+
|
38
|
+
spec.add_dependency 'actionpack', '>= 5.2'
|
39
|
+
spec.add_dependency 'activesupport', '>= 5.2'
|
39
40
|
end
|
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.
|
4
|
+
version: 2.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.2'
|
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
|
-
version: '
|
26
|
+
version: '5.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.2'
|
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
|
-
version: '
|
40
|
+
version: '5.2'
|
41
41
|
description: A Rails Helper to create time tags usable for jQuery Timeago plugin
|
42
42
|
email:
|
43
43
|
- jgraichen@altimos.de
|
@@ -132,6 +132,7 @@ metadata:
|
|
132
132
|
homepage_uri: https://github.com/jgraichen/rails-timeago
|
133
133
|
source_code_uri: https://github.com/jgraichen/rails-timeago
|
134
134
|
changelog_uri: https://github.com/jgraichen/rails-timeago/blob/master/CHANGELOG.md
|
135
|
+
rubygems_mfa_required: 'true'
|
135
136
|
post_install_message:
|
136
137
|
rdoc_options: []
|
137
138
|
require_paths:
|
@@ -140,14 +141,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
141
|
requirements:
|
141
142
|
- - ">="
|
142
143
|
- !ruby/object:Gem::Version
|
143
|
-
version: 2.
|
144
|
+
version: '2.5'
|
144
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
146
|
requirements:
|
146
147
|
- - ">="
|
147
148
|
- !ruby/object:Gem::Version
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.3.3
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: jQuery Timeago helper for Rails 3
|