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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 985fb72650e4c3de624f424a76045512cd87a5da81b4f4b3a469c1a4f9259b97
4
- data.tar.gz: 49f1fe38563be47454abb704ed4f0255a013ead175095d54e1b46e3f95a83be9
3
+ metadata.gz: ccf326f39e2cdccc7cb9991e0f9ad738b97ff3d1ca1837ea0793907e1cf07e72
4
+ data.tar.gz: f94e5fec99ef45102ac05d9523d68b1db95c2a61a13a331553419de7feb2dc46
5
5
  SHA512:
6
- metadata.gz: c0912d4b8618ee9cc06cea7037b8decd3f6e2517450636ddc2344298b65f80f45ece0e33a31066fc164888f702b9ab64c5caf92b475db80bfcad036cf9c26119
7
- data.tar.gz: 969f8ede03fcadebc1f62f20169d7dd7f6cfa3b2d538694c0d1171426b002dd8560a8bff0f5928759e4a654018fabea0fc5f8b98ee8a8c28a9111abf6a85a9a9
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. Pin the Stimulus controller
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
- ### 4. Include the stylesheet
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
- ### 5. Render the banner
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.element.hidden = true; this.element.setAttribute("aria-hidden", "true") }
86
- #showBanner() { this.element.hidden = false; this.element.removeAttribute("aria-hidden") }
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
- .biscuit-banner[data-biscuit-position-value="bottom"] {
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
- .biscuit-banner[data-biscuit-position-value="top"] {
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 class="biscuit-banner"
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>
@@ -0,0 +1 @@
1
+ pin "biscuit/biscuit_controller", to: "biscuit/biscuit_controller.js"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Biscuit
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
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.2
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-20 00:00:00.000000000 Z
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