README.md in micoo-0.1.3 vs README.md in micoo-0.3.0
- old
+ new
@@ -1,55 +1,77 @@
# Micoo
-[![Gem Version](https://badge.fury.io/rb/micoo.png)](http://badge.fury.io/rb/micoo)
+[![Gem Version](https://badge.fury.io/rb/micoo.svg)](http://badge.fury.io/rb/micoo)
[![GEM Downloads](https://img.shields.io/gem/dt/micoo?color=168AFE&logo=ruby&logoColor=FE1616)](https://rubygems.org/gems/micoo)
+[![rake](https://github.com/matique/micoo/actions/workflows/rake.yml/badge.svg)](https://github.com/matique/micoo/actions/workflows/rake.yml)
+[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://choosealicense.com/licenses/mit/)
Micoo (minimal Cookie) is a Rails Engine handling the Cookie consent.
Besides installing the gem just a minimal code is required (see _Usage_).
Micoo display a styled text including buttons for
accepting or rejecting usage of cookies.
Clicking *Accept* set the cookie "cookiesOK" to "x",
-clicking *Reject" will delete the cookie.
+clicking *Reject* will delete the cookie.
## Optional Parameters
Optional parameters for *CookiesComponent.new(...)* are:
### _text_
Default is:
> You may delete and block all cookies from this site,
-but parts of the site will not work.
-
+> but parts of the site will not work.
+>
> Click *Accept* if you consent usage of cookies, otherwise click *Reject*.
-### _text2_
-
-_text2_ may be used to
-add additional text and links for further description.
-
### _url_
Redirection to _url_ will be triggered by clicking *Accept* or *Reject*.
-Defult is "/".
+Default is *request.url*.
## Usage
```ruby
+# config/routes.rb
+Rails.application.routes.draw do
+ ...
+ get "/cookies/accept"
+ get "/cookies/reject"
+ ...
+end
+```
+
+```ruby
# app/controllers/application_controller.rb (recommended)
...
before_action :always
def always
unless cookies[:cookiesOK] == "x"
- render CookiesComponent.new(url: root_path)
+ render CookiesComponent.new(url: request.url)
end
end
...
+```
+
+## I18n
+You may provide an "internationalized" text via the _text_ parameter.
+
+_Micoo_ buttons uses the I18n.translate method for the legend.
+A configuration file (a sample) may be:
+
+```ruby
+# config/locales/en.yml
+en:
+ micoo:
+ button:
+ accept: Accept
+ reject: Reject
```
## Installation
As usual: