-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate the reorder sections page to the design system
Update the page for reordering sections within a manual so that it is using the `design_system` layout, and is built using UI components from the design system. The `reorderable_list` component structures the form data differently to how the original page did, requiring changes on the server side to handle this difference when the data is submitted.
- Loading branch information
1 parent
16e911c
commit cd120b3
Showing
5 changed files
with
47 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,45 @@ | ||
<% content_for :page_title, "Reorder sections" %> | ||
|
||
<% content_for :breadcrumbs do %> | ||
<li><%= link_to "Your manuals", manuals_path %></li> | ||
<li><%= link_to manual.title, manual_path(manual) %></li> | ||
<li class="active">Reorder sections</li> | ||
<%= render "govuk_publishing_components/components/breadcrumbs", { | ||
collapse_on_mobile: true, | ||
breadcrumbs: [ | ||
{ | ||
title: "Your manuals", | ||
url: manuals_path | ||
}, | ||
{ | ||
title: manual.title, | ||
url: manual_path(manual) | ||
}, | ||
{ | ||
title: "Reorder sections" | ||
}, | ||
] | ||
} %> | ||
<% end %> | ||
|
||
<h1 class="page-header"> | ||
<h1 class="govuk-heading-xl"> | ||
Reorder sections | ||
</h1> | ||
|
||
<%= form_tag(update_order_manual_sections_path(manual), method: :post) do %> | ||
<div class="row"> | ||
<div class="col-md-8"> | ||
<ol class="reorderable-document-list"> | ||
<% sections.each do |section| %> | ||
<li> | ||
<input type="hidden" name="section_order[]" value="<%= section.uuid %>"> | ||
<%= section.title %> | ||
</li> | ||
<% end %> | ||
</ol> | ||
</div> | ||
</div> | ||
<%= render "govuk_publishing_components/components/reorderable_list", { | ||
input_name: "section_order", | ||
items: manual.sections.map do |section| | ||
{ | ||
id: section.uuid, | ||
title: section.title | ||
} | ||
end | ||
} %> | ||
|
||
<div class="govuk-button-group govuk-!-margin-bottom-6"> | ||
<%= render "govuk_publishing_components/components/button", { | ||
text: "Save section order", | ||
name: "submit", | ||
} %> | ||
|
||
<div class="actions"> | ||
<button name="submit" class="btn btn-primary">Save section order</button> | ||
<%= link_to "Back", manual_path(manual), class: "action-link" %> | ||
<%= link_to("Cancel", manual_path(manual), class: "govuk-link govuk-link--no-visited-state") %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters