Skip to content

Commit

Permalink
Use component wrapper on reorderable list component
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGDS committed Dec 3, 2024
1 parent c151adf commit 21ed67d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Support Welsh devolved nations component ([PR #4440](https://github.com/alphagov/govuk_publishing_components/pull/4440))
* Use component wrapper on previous and next component ([PR #4463](https://github.com/alphagov/govuk_publishing_components/pull/4463))
* Use component wrapper on related nav component ([PR #4466](https://github.com/alphagov/govuk_publishing_components/pull/4466))
* Use component wrapper on reorderable list component ([PR #4474](https://github.com/alphagov/govuk_publishing_components/pull/4474))

## 46.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

items ||= []
input_name ||= "ordering"
data_attributes ||= {}
data_attributes[:module] = "reorderable-list"

component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.add_class("gem-c-reorderable-list")
component_helper.add_data_attribute({ module: "reorderable-list" })
%>

<%= tag.ol class: "gem-c-reorderable-list", data: data_attributes do %>
<%= tag.ol(**component_helper.all_attributes) do %>
<% items.each_with_index do |item, index| %>
<%= tag.li class: "gem-c-reorderable-list__item" do %>
<%= tag.div class: "gem-c-reorderable-list__wrapper" do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ body: |
you'd receive a submission of `ordering[a]=1&ordering[b]=2`, which Rails can
translate to `"ordering" => { "a" => "1", "b" => "2" }`.
uses_component_wrapper_helper: true
accessibility_criteria: |
Buttons in this component must:
Expand Down

0 comments on commit 21ed67d

Please sign in to comment.