biscuit-rails 0.1.2 → 0.1.4
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 +27 -0
- data/README.md +3 -11
- data/app/assets/javascripts/biscuit/biscuit_controller.js +3 -3
- data/app/assets/stylesheets/biscuit/biscuit.css +3 -2
- data/app/views/biscuit/banner/_banner.html.erb +7 -3
- data/config/importmap.rb +1 -0
- data/lib/biscuit/engine.rb +8 -0
- data/lib/biscuit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ccf326f39e2cdccc7cb9991e0f9ad738b97ff3d1ca1837ea0793907e1cf07e72
|
|
4
|
+
data.tar.gz: f94e5fec99ef45102ac05d9523d68b1db95c2a61a13a331553419de7feb2dc46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37b281be185c6e46f19ada084760ec585ff2e144dd15c532a5d94188610809488fbafe6d7fcfb64881bcc87f54b5ee22876ac7f7809079197cbee408e999ca61
|
|
7
|
+
data.tar.gz: 32d9e8d34b824c355a190041c58d5fc6b33ad436ae9100b4babec40fb8585ca2031d0cc683d369590ca9fea6f9afe9972650a74a474448a06332df2def4e710e
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ 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.4] - 2026-03-29
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Incorrect CSS float on banner element causing layout issues
|
|
13
|
+
- Incorrect banner height at small viewport widths
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## [0.1.3] - 2026-03-28
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Manage link ("Cookie settings") button now works correctly — it was rendered
|
|
22
|
+
outside the Stimulus controller's element scope, so targets and actions were
|
|
23
|
+
never connected. The banner partial now wraps both the banner and the manage
|
|
24
|
+
link in a single controller root element.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Engine auto-registers its importmap pin with the host app via a
|
|
29
|
+
`biscuit.importmap` initializer — users no longer need to manually add
|
|
30
|
+
`pin "biscuit/biscuit_controller"` to `config/importmap.rb`. No-op in
|
|
31
|
+
esbuild/jsbundling apps.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
8
35
|
## [0.1.2] - 2026-03-20
|
|
9
36
|
|
|
10
37
|
### 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
|
|
|
@@ -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
|
}
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
padding: var(--biscuit-padding);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
[data-biscuit-position-value="bottom"] .biscuit-banner {
|
|
30
30
|
bottom: 0;
|
|
31
31
|
box-shadow: var(--biscuit-shadow-bottom);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
[data-biscuit-position-value="top"] .biscuit-banner {
|
|
35
35
|
top: 0;
|
|
36
36
|
box-shadow: var(--biscuit-shadow-top);
|
|
37
37
|
}
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
|
|
119
119
|
@media (max-width: 640px) {
|
|
120
120
|
.biscuit-banner__inner { flex-direction: column; align-items: flex-start; }
|
|
121
|
+
.biscuit-banner__message { flex-basis: auto; }
|
|
121
122
|
.biscuit-banner__actions { width: 100%; }
|
|
122
123
|
.biscuit-btn { flex: 1 1 auto; justify-content: center; }
|
|
123
124
|
}
|
|
@@ -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"
|
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.4
|
|
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-29 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -39,6 +39,7 @@ 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
|
|
42
43
|
- config/locales/de.yml
|
|
43
44
|
- config/locales/en.yml
|
|
44
45
|
- config/locales/es.yml
|