Skip to content

Commit

Permalink
Merge pull request #9702 from alphagov/content-modelling/744-confirma…
Browse files Browse the repository at this point in the history
…tion

Content modelling/744 confirmation
  • Loading branch information
Harriethw authored Dec 4, 2024
2 parents b2b10ec + b1e715e commit 78ea3c0
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,26 @@ def review
def confirmation
@content_block_edition = ContentBlockManager::ContentBlock::Edition.find(params[:id])

confirmation_copy

render :confirmation
end

def confirmation_copy
if params[:is_scheduled]
@panel_copy = "Your content block is scheduled for change"
@paragraph_copy = "Your content block has been edited and is now scheduled for change."
@panel_copy = "#{@content_block_edition.block_type.humanize} scheduled to publish on #{I18n.l(@content_block_edition.scheduled_publication, format: :long_ordinal)}"
@paragraph_copy = "You can now view the updated schedule of the content block."
elsif more_than_one_edition?
@panel_copy = "#{@content_block_edition.block_type.humanize} published"
@paragraph_copy = "You can now view the updated content block."
else
@panel_copy = "Your content block is available for use"
@paragraph_copy = "Your content block has been published and is now available for use."
@panel_copy = "#{@content_block_edition.block_type.humanize} created"
@paragraph_copy = "You can now view the content block."
end
end

render :confirmation
def more_than_one_edition?
@content_block_edition.document.editions.count > 1
end

def review_links
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters govuk-body">
<h2 class="govuk-heading-m">What happens next</h2>
<p><%= @paragraph_copy %><br>
If you need any support or want to delete an instance you can
<%= link_to "raise a support request", support_url, class: "govuk-link--no-visited-state" %>
<h2 class="govuk-heading-m">What happens next?</h2>
<p><%= @paragraph_copy %> If you need any support or want to delete a content block you can raise a support request.
</p>
<%= render "govuk_publishing_components/components/button", {
text: "View content block",
name: "view",
value: "view",
href: content_block_manager.content_block_manager_content_block_document_path(@content_block_edition.document.id),
<div class="govuk-button-group">
<%= render "govuk_publishing_components/components/button", {
text: "View content block",
name: "view",
value: "view",
href: content_block_manager.content_block_manager_content_block_document_path(@content_block_edition.document.id),
} %>
<%= render "govuk_publishing_components/components/button", {
text: "Raise a support request",
href: support_url,
secondary_solid: true,
} %>
} %>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: Create a content object
Then I am asked to review my answers
When I click confirm
Then the edition should have been created successfully
And I should be taken to the confirmation page
And I should be taken to the confirmation page for a new block

Scenario: GDS editor sees validation errors when not selecting an object type
When I visit the Content Block Manager home page
Expand Down Expand Up @@ -88,7 +88,7 @@ Feature: Create a content object
Then I am asked to review my answers
When I click confirm
Then the edition should have been created successfully
And I should be taken to the confirmation page
And I should be taken to the confirmation page for a new block

Scenario: Draft documents are not listed
When I visit the Content Block Manager home page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Feature: Edit a content object
And I should see a back link to the review page
When I choose to publish the change now
And I accept and publish
Then I should be taken to the confirmation page
Then I should be taken to the confirmation page for a published block
When I click to view the content block
Then the edition should have been updated successfully
And I should be taken back to the document page
Expand Down Expand Up @@ -90,7 +90,7 @@ Feature: Edit a content object
When I make the changes
And I choose to publish the change now
And I accept and publish
Then I should be taken to the confirmation page
Then I should be taken to the confirmation page for a published block
When I click to view the content block
Then the edition should have been updated successfully

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,38 @@
end
end

And("I should be taken to the confirmation page") do
assert_text "Your content block is available for use"
assert_text "Your content block has been published and is now available for use."
And("I should be taken to the confirmation page for a published block") do
assert_text "Email address published"
assert_text "You can now view the updated content block. If you need any support or want to delete a content block you can raise a support request."
expect(page).to have_link(
"View content block",
href: content_block_manager.content_block_manager_content_block_document_path(
ContentBlockManager::ContentBlock::Edition.last.document,
),
)

has_support_button
end

def has_support_button
expect(page).to have_link(
"Raise a support request",
href: Whitehall.support_url,
)
end

And("I should be taken to the confirmation page for a new block") do
assert_text "Email address created"
assert_text "You can now view the content block. If you need any support or want to delete a content block you can raise a support request."

expect(page).to have_link(
"View content block",
href: content_block_manager.content_block_manager_content_block_document_path(
ContentBlockManager::ContentBlock::Edition.last.document,
),
)

has_support_button
end

When("I click to view the content block") do
Expand All @@ -169,15 +191,17 @@
end

When("I should be taken to the scheduled confirmation page") do
assert_text "Your content block is scheduled for change"
assert_text "Your content block has been edited and is now scheduled for change."
assert_text "Email address scheduled to publish on #{@future_date.strftime('%e %B %Y%l:%M%P').strip}"
assert_text "You can now view the updated schedule of the content block."

expect(page).to have_link(
"View content block",
href: content_block_manager.content_block_manager_content_block_document_path(
ContentBlockManager::ContentBlock::Edition.last.document,
),
)

has_support_button
end

Then("I should be taken back to the document page") do
Expand Down

0 comments on commit 78ea3c0

Please sign in to comment.