-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2374 from alphagov/unpublish-edition-edit
Unpublish edition edit
- Loading branch information
Showing
14 changed files
with
403 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module CommonComponentsHelper | ||
def header_for(tab_name) | ||
render "govuk_publishing_components/components/heading", { | ||
text: tab_name, | ||
heading_level: 2, | ||
margin_bottom: 5, | ||
} | ||
end | ||
|
||
def primary_button_for(model, url, text) | ||
form_for model, url:, method: :post do | ||
render "govuk_publishing_components/components/button", { | ||
text:, | ||
margin_bottom: 3, | ||
} | ||
end | ||
end | ||
|
||
def secondary_button_for(model, url, text) | ||
form_for model, url:, method: :post do | ||
render "govuk_publishing_components/components/button", { | ||
text:, | ||
margin_bottom: 3, | ||
secondary_solid: true, | ||
} | ||
end | ||
end | ||
|
||
def primary_link_button_for(url, text) | ||
render "govuk_publishing_components/components/button", { | ||
text:, | ||
href: url, | ||
margin_bottom: 3, | ||
} | ||
end | ||
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<% @edition = @resource %> | ||
<%= header_for("Unpublish") %> | ||
|
||
<%= render "govuk_publishing_components/components/inset_text", { | ||
text: "If you unpublish a page from GOV.UK it cannot be undone.", | ||
} %> | ||
|
||
<%= form_for @edition, url: confirm_unpublish_edition_path, method: "get" do |f| %> | ||
<%= render "govuk_publishing_components/components/input", { | ||
label: { | ||
text: "Redirect to URL", | ||
}, | ||
id: "redirect_url", | ||
name: "redirect_url", | ||
value: params[:redirect_url], | ||
hint: "For example: https://www.gov.uk/redirect-to-replacement-page", | ||
heading_level: 3, | ||
heading_size: "s", | ||
error_items: errors_for(f.object.errors, :redirect_url, use_full_message: false), | ||
} %> | ||
<div class="govuk-button-group"> | ||
<%= render("govuk_publishing_components/components/button", { | ||
text: "Continue", | ||
type: "submit", | ||
}) %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> |
39 changes: 39 additions & 0 deletions
39
app/views/editions/secondary_nav_tabs/confirm_unpublish.html.erb
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<% @edition = @resource %> | ||
<% content_for :title_context, @edition.title %> | ||
<% content_for :page_title, "Unpublish" %> | ||
<% content_for :title, "Unpublish" %> | ||
<div class="govuk-grid-row"> | ||
<% unless @edition.errors.empty? %> | ||
<% content_for :error_summary do %> | ||
<%= render("govuk_publishing_components/components/error_summary", { | ||
id: "error-summary", | ||
title: "There is a problem", | ||
items: @edition.errors.map do |error| | ||
{ | ||
text: error.message, | ||
href: "##{error.attribute.to_s}", | ||
} | ||
end, | ||
}) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<div class="govuk-grid-column-two-thirds"> | ||
<%= render "govuk_publishing_components/components/inset_text", { | ||
text: "If you unpublish a page from GOV.UK it cannot be undone.", | ||
} %> | ||
|
||
<%= form_for @edition, url: process_unpublish_edition_path(@edition), method: :post do %> | ||
<%= hidden_field_tag :redirect_url, params[:redirect_url] %> | ||
<p class="govuk-body govuk-!-margin-bottom-7">Are you sure you want to unpublish this document?</p> | ||
<div class="govuk-button-group"> | ||
<%= render "govuk_publishing_components/components/button", { | ||
text: "Unpublish document", | ||
destructive: true, | ||
} %> | ||
<%= link_to("Cancel", unpublish_edition_path, class: "govuk-link govuk-link--no-visited-state") %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> |
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
Oops, something went wrong.