dsfr_accessible_skip_links 0.1.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4afbed35674b0ec24dfc35c348b73396f4ed4ffba52f4924aec310eb876e0a3
4
- data.tar.gz: 26577cd195e55cb9e7dc0d732c121b1f6fca3f71dd1bd8a8fed0690082f5ae76
3
+ metadata.gz: 1c1aa834669fc2810bad9ffe69cad4af0d1640ea1b294d514c755b72e80cea81
4
+ data.tar.gz: 57a4ffa98aa9217fd8937a137df89a810ddf04fbda942e5b1736baabbf5c3911
5
5
  SHA512:
6
- metadata.gz: c642f22b47fbb7df60a42dbe1c9155792feb0c81243d407f6e8870511d56a07acd66fe0439fb8729562fea46c6351ba3ec2aa1ec13bf477c901ca76d0e71e467
7
- data.tar.gz: ef4bf61ee5484dd794b73dbcbee89a9f4dd72d06dd4525849bfe34c19d86e32020a2843272e380a13bc31c102256478a2d46304a7e265cc280f2e9ba3051361a
6
+ metadata.gz: b2fa2f71d3ed56fe3dbbc9966e57ff9743a2bdc360a16fb17574396fcbb978d1659abfd5e865e5c2addb95a69dd350b9b39e9bc681a852598a2245b9a276ebd5
7
+ data.tar.gz: d4ca7582ffe46826b82801d41f673b29cbae349e01be2d0c77f54450d09f1e0ad957440b74fc0f5128b64c2ecdf2549d550ddb1eb0e631474b944f4921dfaffb
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.3] - 2025-08-27
11
+ ### Fixed
12
+ - Generator now uses `copy_file` instead of `template` to avoid evaluating ERB in the partial during generation. This prevents `NameError` for `skip_links_content`.
13
+ - Ensure DsfrAccessibleSkipLinks::SkipLinks is automatically included using `ActiveSupport.on_load` hooks:
14
+ - Included into `ActionController::Base` (controller-side) and exposed as view helpers
15
+ - Included into `ActionView` (view-side) so helpers are available in templates without manual setup
16
+
10
17
  ## [0.1.2] - 2025-08-27
11
18
  ### Added
12
19
  - Rails generator `dsfr_accessible_skip_links:install` to copy the skip links partial and inject the render call into the application layout.
data/README.md CHANGED
@@ -26,7 +26,7 @@ You can also install the gem itself directly as:
26
26
 
27
27
  ### Rails Integration
28
28
 
29
- The gem automatically integrates with Rails through a Rails Engine. The `SkipLinks` module is automatically included in `ApplicationController`.
29
+ The gem automatically integrates with Rails through a Rails Engine. The `SkipLinks` module is automatically included in controllers and views (via Rails on_load hooks), so you can call the helpers directly from templates and controllers.
30
30
 
31
31
  In your layout file (e.g., `app/views/layouts/application.html.erb`), add the skip links at the top:
32
32
 
@@ -14,8 +14,16 @@ module DsfrAccessibleSkipLinks
14
14
  end
15
15
  end
16
16
 
17
- config.to_prepare do
18
- ApplicationController.include(DsfrAccessibleSkipLinks::SkipLinks) if defined?(ApplicationController)
17
+ # Ensure helpers are available automatically in controllers and views
18
+ initializer "dsfr_accessible_skip_links.helpers" do
19
+ ActiveSupport.on_load(:action_controller_base) do
20
+ include DsfrAccessibleSkipLinks::SkipLinks
21
+ helper DsfrAccessibleSkipLinks::SkipLinks if respond_to?(:helper)
22
+ end
23
+
24
+ ActiveSupport.on_load(:action_view) do
25
+ include DsfrAccessibleSkipLinks::SkipLinks
26
+ end
19
27
  end
20
28
  end
21
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DsfrAccessibleSkipLinks
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -12,7 +12,8 @@ module DsfrAccessibleSkipLinks
12
12
  "and injecting the render call into the application layout."
13
13
  )
14
14
  def copy_partial
15
- template "_skip_links.html.erb", "app/views/shared/_skip_links.html.erb"
15
+ # Use copy_file instead of template to avoid evaluating ERB in the generator context
16
+ copy_file "_skip_links.html.erb", "app/views/shared/_skip_links.html.erb"
16
17
  end
17
18
 
18
19
  # rubocop:disable Metrics/MethodLength
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsfr_accessible_skip_links
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isabelle Lafont
@@ -127,7 +127,7 @@ metadata:
127
127
  changelog_uri: https://github.com/Isalafont/dsfr_accessible_skip_links/blob/main/CHANGELOG.md
128
128
  rubygems_mfa_required: 'true'
129
129
  post_install_message: |
130
- Thank you for installing dsfr_accessible_skip_links (v0.1.2)!
130
+ Thank you for installing dsfr_accessible_skip_links (v0.1.3)!
131
131
 
132
132
  To complete setup in your Rails app, run:
133
133
  bin/rails g dsfr_accessible_skip_links:install