README.md in rails-timeago-2.19.1 vs README.md in rails-timeago-2.20.0
- old
+ new
@@ -1,16 +1,16 @@
# rails-timeago
[![Gem Version](https://img.shields.io/gem/v/rails-timeago?logo=ruby)](https://rubygems.org/gems/rails-timeago)
-[![Build Status](https://img.shields.io/travis/jgraichen/rails-timeago/master?logo=travis)](https://travis-ci.org/jgraichen/rails-timeago)
+[![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)
**rails-timeago** provides a timeago_tag helper to create time tags usable for
[jQuery Timeago](https://github.com/rmm5t/jquery-timeago) plugin.
## Installation
-Add this line to your application's `Gemfile`:
+Add this line to your `Gemfile`:
```ruby
gem 'rails-timeago', '~> 2.0'
```
@@ -20,10 +20,14 @@
Or install it yourself as:
$ gem install rails-timeago
+### Use bundled JavaScript with Sprockets
+
+*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.
+
To use bundled jQuery Timeago plugin add this require statement to your `application.js` file:
//= require rails-timeago
This will also convert all matching time tags on page load.
@@ -93,9 +97,11 @@
The following snippet will print a script tag that set the jQuery timeago locale according to your `I18n.locale`:
```erb
<%= timeago_script_tag %>
```
+
+Arguments are passed to Rails' `javascript_tag` helper, e.g. to assign a CSP nonce: `timeago_script_tag(nonce: true)`.
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:
```js
jQuery.timeago.settings.lang = $('html').attr('lang')