rails-timeago 2.19.1 → 2.20.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
  SHA256:
3
- metadata.gz: d2f04682a7ba3fcb6eb2600fe9cc15a824ad2402be862b744f249a77cf7bf2c0
4
- data.tar.gz: e2e4b06684047da1b141325b377acebe0e4925e4a6dafd0e5045e10e43886ede
3
+ metadata.gz: 32c4caa5aad3c864a7d9c9c1bd6a75641a4d5212fc121b069156903ff06378e3
4
+ data.tar.gz: '085ce3e027269aff9b46e3e0deed3e3198f21688fc608b5ba04ab1ffb707cd1f'
5
5
  SHA512:
6
- metadata.gz: 55d4ab0cadb376c2e309f973d1f89858f3b72ab27a6fd46ddcda36684e3287d673ff567b927d715495a059d078452be05a708e48acbf97b2993caeede0216ed1
7
- data.tar.gz: 2d31b69f140b157941212b44169e91a4e6d8cc008bfff0f8a222b086c8450691451ba8fef50a2ad8cd0753ad03b5258020d8386a0fcea83a5b9fc2730690a72d
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/travis/jgraichen/rails-timeago/master?logo=travis)](https://travis-ci.org/jgraichen/rails-timeago)
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 application's `Gemfile`:
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
@@ -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 "jQuery.timeago.settings.lang=\"#{I18n.locale}\";" if I18n.locale != 'en'
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 = 19
8
- PATCH = 1
7
+ MINOR = 20
8
+ PATCH = 0
9
9
  STAGE = nil
10
- STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.').freeze
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
@@ -72,7 +72,7 @@ module Rails
72
72
  limit: proc { 4.days.ago },
73
73
  date_only: true,
74
74
  default: '-',
75
- title: proc {|time, options| I18n.l time, format: options[:format] }
75
+ title: proc {|time, options| I18n.l time, format: options[:format] },
76
76
  }
77
77
  end
78
78
  end
@@ -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.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'
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.add_dependency 'actionpack', '>= 3.1'
38
- spec.add_dependency 'activesupport', '>= 3.1'
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.19.1
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: 2021-02-11 00:00:00.000000000 Z
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: '3.1'
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: '3.1'
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: '3.1'
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: '3.1'
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.4.0
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.2.7
151
+ rubygems_version: 3.3.3
151
152
  signing_key:
152
153
  specification_version: 4
153
154
  summary: jQuery Timeago helper for Rails 3