Skip to content

Commit

Permalink
Add confirmation page for finder facets
Browse files Browse the repository at this point in the history
Introduce page to confirm changes to the facets of a finder.
  • Loading branch information
dnkrj authored and ChrisBAshton committed Dec 27, 2024
1 parent 76bdb10 commit 1eae04c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ def summary; end

def edit_facets; end

def confirm_metadata
render :confirm_facets
end

def edit_metadata; end

def confirm_metadata

Check failure on line 16 in app/controllers/admin_controller.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Lint/DuplicateMethods: Method `AdminController#confirm_metadata` is defined at both app/controllers/admin_controller.rb:10 and app/controllers/admin_controller.rb:16.
Expand Down
1 change: 1 addition & 0 deletions app/policies/document_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def can_request_edits_to_finder?
end
alias_method :summary?, :can_request_edits_to_finder?
alias_method :edit_facets?, :can_request_edits_to_finder?
alias_method :confirm_facets?, :can_request_edits_to_finder?
alias_method :edit_metadata?, :can_request_edits_to_finder?
alias_method :confirm_metadata?, :can_request_edits_to_finder?
alias_method :zendesk?, :can_request_edits_to_finder?
Expand Down
50 changes: 50 additions & 0 deletions app/views/admin/confirm_facets.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<% content_for :breadcrumbs do %>
<%= render "govuk_publishing_components/components/breadcrumbs", {
collapse_on_mobile: true,
breadcrumbs: [
{
title: "All finders",
url: root_path
},
{
title: "#{current_format.title} finder",
url: "/admin/#{current_format.admin_slug}"
},
{
title: "Request change",
url: "/admin/facets/#{current_format.admin_slug}"
},
{
title: "Check changes",
url: request.original_url
}
]
} %>
<% end %>
<% content_for :page_title, "Edit #{current_format.title} finder" %>
<% content_for :title, "Check your changes before submitting" %>
<% content_for :context, "#{current_format.title} finder" %>


<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds govuk-body govuk-!-margin-top-8">
<%= render "facets_summary_card", {
schema: @current_format.finder_schema.schema,
} %>

<p class="govuk-body govuk-body govuk-!-margin-top-7">
By submitting you are confirming that these changes are required to the specialist finder.
</p>

<div class="govuk-button-group govuk-!-margin-top-7">
<%= form_tag "/admin/zendesk/#{current_format.admin_slug}", method: 'post' do %>
<%= hidden_field_tag :proposed_schema, JSON.pretty_generate(@proposed_schema) %>
<%= render "govuk_publishing_components/components/button", {
text: "Submit changes"
} %>
<% end %>

<%= link_to("Cancel", "/admin/#{current_format.admin_slug}", class: "govuk-link govuk-link--no-visited-state") %>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

get "/admin/:document_type_slug", to: "admin#summary"
get "/admin/facets/:document_type_slug", to: "admin#edit_facets"
post "/admin/facets/:document_type_slug", to: "admin#confirm_facets"
get "/admin/metadata/:document_type_slug", to: "admin#edit_metadata"
post "/admin/metadata/:document_type_slug", to: "admin#confirm_metadata"
post "/admin/zendesk/:document_type_slug", to: "admin#zendesk"
Expand Down

0 comments on commit 1eae04c

Please sign in to comment.