Skip to content

Commit

Permalink
redirect back to "Add objects" page in create flow
Browse files Browse the repository at this point in the history
there was an optional value for a `@redirect_url`
that is set during the edit flow - it isn't clear
that this is required, so when it is not we want
to default to send them back to the 'add a' page,
as this should make sense either in create or edit
flow.
  • Loading branch information
Harriethw committed Feb 25, 2025
1 parent b1a3b0b commit 09013aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :context, @content_block_document.title %>
<% content_for :title, "Add a #{@subschema.name.singularize.downcase}" %>
<% content_for :title, "Add a from document #{@subschema.name.singularize.downcase}" %>

<% content_for :back_link do %>
<%= render "govuk_publishing_components/components/back_link", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
} %>
<%= render "govuk_publishing_components/components/button", {
text: "Cancel",
href: @redirect_url,
href: @redirect_url.presence || content_block_manager.content_block_manager_content_block_workflow_path(id: @content_block_edition.id, step: "embedded_#{@subschema.block_type}"),
secondary_solid: true,
} %>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ Feature: Create a content object
And I review and confirm my answers are correct
Then I should be taken to the confirmation page for a new "pension"

Scenario: GDS editor creates a Pension and cancels on the first rate
When I visit the Content Block Manager home page
And I click to create an object
Then I should see all the schemas listed
When I click on the "pension" schema
Then I should see a form for the schema
When I complete the form with the following fields:
| title | description | organisation | instructions_to_publishers |
| my basic pension | this is basic | Ministry of Example | this is important |
When I click to add a new "rate"
And I click the cancel link
Then I should be on the "embedded_rates" step

Scenario: GDS editor clicks back and is taken back to rates
When I visit the Content Block Manager home page
And I click to create an object
Expand Down

0 comments on commit 09013aa

Please sign in to comment.