biscuit-rails 0.1.1 → 0.1.3
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 +4 -4
- data/CHANGELOG.md +26 -0
- data/README.md +22 -29
- data/app/assets/javascripts/biscuit/biscuit_controller.js +3 -3
- data/app/views/biscuit/banner/_banner.html.erb +7 -3
- data/config/importmap.rb +1 -0
- data/config/locales/de.yml +24 -0
- data/config/locales/es.yml +24 -0
- data/lib/biscuit/engine.rb +8 -0
- data/lib/biscuit/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7054c18a5049310cc03f684c2d8ce5c2a835276ffc2ac5c7fb7ad453a0683336
|
|
4
|
+
data.tar.gz: 90b033ac9021dde624c9be3da900d3dedfb2697858ccafa536c28ba976f33a70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 438ed681f247bfcde15c397a53f1765ee984e799abf8634af90308a2b3dc64b12ca222965bbca5b3bee49b8428e1a57ec0b3f25d97f98e9bcf7ed46e4d17483d
|
|
7
|
+
data.tar.gz: 9c1f5f8363f50d9da83f8a82184725dbeed20b98073146437d2d2443036b504db365f77a2551b2ed40cff2505e4d5cd89bc19a45268d0a6af571a994d3f774aa
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.3] - 2026-03-28
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Manage link ("Cookie settings") button now works correctly — it was rendered
|
|
13
|
+
outside the Stimulus controller's element scope, so targets and actions were
|
|
14
|
+
never connected. The banner partial now wraps both the banner and the manage
|
|
15
|
+
link in a single controller root element.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Engine auto-registers its importmap pin with the host app via a
|
|
20
|
+
`biscuit.importmap` initializer — users no longer need to manually add
|
|
21
|
+
`pin "biscuit/biscuit_controller"` to `config/importmap.rb`. No-op in
|
|
22
|
+
esbuild/jsbundling apps.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## [0.1.2] - 2026-03-20
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- German (`de`) and Spanish (`es`) locale files
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
8
34
|
## [0.1.1] - 2026-03-19
|
|
9
35
|
|
|
10
36
|
### Added
|
data/README.md
CHANGED
|
@@ -50,15 +50,7 @@ Rails.application.routes.draw do
|
|
|
50
50
|
end
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
### 2.
|
|
54
|
-
|
|
55
|
-
In `config/importmap.rb`:
|
|
56
|
-
|
|
57
|
-
```ruby
|
|
58
|
-
pin "biscuit/biscuit_controller", to: "biscuit/biscuit_controller.js"
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### 3. Register the Stimulus controller
|
|
53
|
+
### 2. Register the Stimulus controller
|
|
62
54
|
|
|
63
55
|
In `app/javascript/controllers/index.js`:
|
|
64
56
|
|
|
@@ -67,7 +59,7 @@ import BiscuitController from "biscuit/biscuit_controller"
|
|
|
67
59
|
application.register("biscuit", BiscuitController)
|
|
68
60
|
```
|
|
69
61
|
|
|
70
|
-
###
|
|
62
|
+
### 3. Include the stylesheet
|
|
71
63
|
|
|
72
64
|
In your layout (`app/views/layouts/application.html.erb`):
|
|
73
65
|
|
|
@@ -75,7 +67,7 @@ In your layout (`app/views/layouts/application.html.erb`):
|
|
|
75
67
|
<%= stylesheet_link_tag "biscuit/biscuit" %>
|
|
76
68
|
```
|
|
77
69
|
|
|
78
|
-
###
|
|
70
|
+
### 4. Render the banner
|
|
79
71
|
|
|
80
72
|
In your layout, inside `<body>`:
|
|
81
73
|
|
|
@@ -361,34 +353,35 @@ lightweight Turbo visit to reload the page after the consent POST succeeds.
|
|
|
361
353
|
|
|
362
354
|
## i18n
|
|
363
355
|
|
|
364
|
-
Biscuit ships with English (`en`)
|
|
365
|
-
|
|
356
|
+
Biscuit ships with translations for English (`en`), French (`fr`),
|
|
357
|
+
German (`de`), and Spanish (`es`). To add another locale, create
|
|
358
|
+
`config/locales/biscuit.<locale>.yml` in your app:
|
|
366
359
|
|
|
367
360
|
```yaml
|
|
368
|
-
|
|
361
|
+
pt:
|
|
369
362
|
biscuit:
|
|
370
363
|
banner:
|
|
371
|
-
aria_label: "
|
|
372
|
-
message: "
|
|
373
|
-
learn_more: "
|
|
374
|
-
accept_all: "
|
|
375
|
-
reject_all: "
|
|
376
|
-
manage: "
|
|
377
|
-
save: "
|
|
378
|
-
reopen: "
|
|
364
|
+
aria_label: "Consentimento de cookies"
|
|
365
|
+
message: "Utilizamos cookies para melhorar a sua experiência neste site."
|
|
366
|
+
learn_more: "Saber mais"
|
|
367
|
+
accept_all: "Aceitar tudo"
|
|
368
|
+
reject_all: "Rejeitar não essenciais"
|
|
369
|
+
manage: "Gerir preferências"
|
|
370
|
+
save: "Guardar preferências"
|
|
371
|
+
reopen: "Definições de cookies"
|
|
379
372
|
categories:
|
|
380
373
|
necessary:
|
|
381
|
-
name: "
|
|
382
|
-
description: "
|
|
374
|
+
name: "Necessários"
|
|
375
|
+
description: "Indispensáveis para o funcionamento do site. Não podem ser desativados."
|
|
383
376
|
analytics:
|
|
384
|
-
name: "
|
|
385
|
-
description: "
|
|
377
|
+
name: "Análise"
|
|
378
|
+
description: "Ajudam-nos a perceber como os visitantes utilizam o site."
|
|
386
379
|
marketing:
|
|
387
380
|
name: "Marketing"
|
|
388
|
-
description: "
|
|
381
|
+
description: "Utilizados para mostrar publicidade personalizada."
|
|
389
382
|
preferences:
|
|
390
|
-
name: "
|
|
391
|
-
description: "
|
|
383
|
+
name: "Preferências"
|
|
384
|
+
description: "Memorizam as suas definições e escolhas de personalização."
|
|
392
385
|
```
|
|
393
386
|
|
|
394
387
|
---
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
|
2
2
|
|
|
3
3
|
export default class extends Controller {
|
|
4
|
-
static targets = ["preferencesPanel", "categoryCheckbox", "manageLink"]
|
|
4
|
+
static targets = ["banner", "preferencesPanel", "categoryCheckbox", "manageLink"]
|
|
5
5
|
static values = {
|
|
6
6
|
endpoint: String,
|
|
7
7
|
csrfToken: String,
|
|
@@ -82,8 +82,8 @@ export default class extends Controller {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
#hideBanner() { this.
|
|
86
|
-
#showBanner() { this.
|
|
85
|
+
#hideBanner() { this.bannerTarget.hidden = true; this.bannerTarget.setAttribute("aria-hidden", "true") }
|
|
86
|
+
#showBanner() { this.bannerTarget.hidden = false; this.bannerTarget.removeAttribute("aria-hidden") }
|
|
87
87
|
#showManageLink() { if (this.hasManageLinkTarget) this.manageLinkTarget.hidden = false }
|
|
88
88
|
#hideManageLink() { if (this.hasManageLinkTarget) this.manageLinkTarget.hidden = true }
|
|
89
89
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
<div
|
|
2
|
-
data-controller="biscuit"
|
|
1
|
+
<div data-controller="biscuit"
|
|
3
2
|
data-biscuit-position-value="<%= Biscuit.configuration.position %>"
|
|
4
3
|
data-biscuit-csrf-token-value="<%= form_authenticity_token %>"
|
|
5
4
|
data-biscuit-endpoint-value="<%= biscuit.consent_path %>"
|
|
6
5
|
data-biscuit-already-consented-value="<%= consent.given? %>"
|
|
7
|
-
data-biscuit-reload-on-consent-value="<%= options[:reload_on_consent] ? 'true' : 'false' %>"
|
|
6
|
+
data-biscuit-reload-on-consent-value="<%= options[:reload_on_consent] ? 'true' : 'false' %>">
|
|
7
|
+
|
|
8
|
+
<div class="biscuit-banner"
|
|
9
|
+
data-biscuit-target="banner"
|
|
8
10
|
role="dialog"
|
|
9
11
|
aria-label="<%= t("biscuit.banner.aria_label") %>"
|
|
10
12
|
aria-modal="false">
|
|
@@ -102,3 +104,5 @@
|
|
|
102
104
|
aria-label="<%= t("biscuit.banner.reopen") %>">
|
|
103
105
|
<%= t("biscuit.banner.reopen") %>
|
|
104
106
|
</button>
|
|
107
|
+
|
|
108
|
+
</div>
|
data/config/importmap.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pin "biscuit/biscuit_controller", to: "biscuit/biscuit_controller.js"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
de:
|
|
2
|
+
biscuit:
|
|
3
|
+
banner:
|
|
4
|
+
aria_label: "Cookie-Einwilligung"
|
|
5
|
+
message: "Wir verwenden Cookies, um Ihr Erlebnis auf dieser Website zu verbessern."
|
|
6
|
+
learn_more: "Mehr erfahren"
|
|
7
|
+
accept_all: "Alle akzeptieren"
|
|
8
|
+
reject_all: "Nicht wesentliche ablehnen"
|
|
9
|
+
manage: "Einstellungen verwalten"
|
|
10
|
+
save: "Einstellungen speichern"
|
|
11
|
+
reopen: "Cookie-Einstellungen"
|
|
12
|
+
categories:
|
|
13
|
+
necessary:
|
|
14
|
+
name: "Notwendig"
|
|
15
|
+
description: "Für die Funktion der Website erforderlich. Kann nicht deaktiviert werden."
|
|
16
|
+
analytics:
|
|
17
|
+
name: "Analyse"
|
|
18
|
+
description: "Helfen uns zu verstehen, wie Besucher die Website nutzen."
|
|
19
|
+
marketing:
|
|
20
|
+
name: "Marketing"
|
|
21
|
+
description: "Werden verwendet, um personalisierte Werbung anzuzeigen."
|
|
22
|
+
preferences:
|
|
23
|
+
name: "Präferenzen"
|
|
24
|
+
description: "Speichern Ihre Einstellungen und Personalisierungsoptionen."
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
es:
|
|
2
|
+
biscuit:
|
|
3
|
+
banner:
|
|
4
|
+
aria_label: "Consentimiento de cookies"
|
|
5
|
+
message: "Utilizamos cookies para mejorar su experiencia en este sitio."
|
|
6
|
+
learn_more: "Más información"
|
|
7
|
+
accept_all: "Aceptar todo"
|
|
8
|
+
reject_all: "Rechazar los no esenciales"
|
|
9
|
+
manage: "Gestionar preferencias"
|
|
10
|
+
save: "Guardar preferencias"
|
|
11
|
+
reopen: "Configuración de cookies"
|
|
12
|
+
categories:
|
|
13
|
+
necessary:
|
|
14
|
+
name: "Necesarias"
|
|
15
|
+
description: "Imprescindibles para el funcionamiento del sitio. No se pueden desactivar."
|
|
16
|
+
analytics:
|
|
17
|
+
name: "Analíticas"
|
|
18
|
+
description: "Nos ayudan a entender cómo los visitantes utilizan el sitio."
|
|
19
|
+
marketing:
|
|
20
|
+
name: "Marketing"
|
|
21
|
+
description: "Se utilizan para mostrar publicidad personalizada."
|
|
22
|
+
preferences:
|
|
23
|
+
name: "Preferencias"
|
|
24
|
+
description: "Recuerdan sus ajustes y opciones de personalización."
|
data/lib/biscuit/engine.rb
CHANGED
|
@@ -13,5 +13,13 @@ module Biscuit
|
|
|
13
13
|
initializer "biscuit.i18n" do
|
|
14
14
|
config.i18n.load_path += Dir[Engine.root.join("config/locales/*.yml")]
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
# Register JS pin with the host app's importmap (importmap-rails only)
|
|
18
|
+
initializer "biscuit.importmap", before: "importmap" do |app|
|
|
19
|
+
if app.config.respond_to?(:importmap)
|
|
20
|
+
app.config.importmap.paths << Engine.root.join("config/importmap.rb")
|
|
21
|
+
app.config.importmap.cache_sweepers << Engine.root.join("app/assets/javascripts")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
16
24
|
end
|
|
17
25
|
end
|
data/lib/biscuit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: biscuit-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gareth James
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-03-
|
|
10
|
+
date: 2026-03-28 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -39,7 +39,10 @@ files:
|
|
|
39
39
|
- app/controllers/biscuit/consent_controller.rb
|
|
40
40
|
- app/helpers/biscuit/biscuit_helper.rb
|
|
41
41
|
- app/views/biscuit/banner/_banner.html.erb
|
|
42
|
+
- config/importmap.rb
|
|
43
|
+
- config/locales/de.yml
|
|
42
44
|
- config/locales/en.yml
|
|
45
|
+
- config/locales/es.yml
|
|
43
46
|
- config/locales/fr.yml
|
|
44
47
|
- config/routes.rb
|
|
45
48
|
- lib/biscuit.rb
|