-
Notifications
You must be signed in to change notification settings - Fork 193
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 #8965 from alphagov/1117-add-ui-for-republish-orga…
…nisation-by-slug Add UI for republishing organisation by slug
- Loading branch information
Showing
12 changed files
with
368 additions
and
60 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
18 changes: 18 additions & 0 deletions
18
app/views/admin/republishing/confirm_organisation.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,18 @@ | ||
<% content_for :page_title, "Republish '#{@organisation.name}'" %> | ||
<% content_for :title, "Are you sure you want to republish '#{@organisation.name}'?" %> | ||
<% content_for :title_margin_bottom, 6 %> | ||
|
||
<div class="govuk-grid-row"> | ||
<section class="govuk-grid-column-two-thirds"> | ||
<p class="govuk-body govuk-!-margin-bottom-7"> | ||
This will schedule the <%= link_to @organisation.name, @organisation.public_url, { class: "govuk-link" } %> organisation to be republished. | ||
</p> | ||
<%= form_with(url: admin_republishing_organisation_republish_path(@organisation.slug), method: :post, data: { | ||
module: "prevent-multiple-form-submissions", | ||
}) do | ||
render("govuk_publishing_components/components/button", { | ||
text: "Confirm republishing", | ||
}) | ||
end %> | ||
</section> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<% content_for :page_title, "Republish an organisation" %> | ||
<% content_for :title, "Which organisation would you like to republish?" %> | ||
<% content_for :title_margin_bottom, 6 %> | ||
|
||
<div class="govuk-grid-row"> | ||
<section class="govuk-grid-column-two-thirds"> | ||
<%= form_with(url: admin_republishing_organisation_search_path, method: :post, data: { | ||
module: "prevent-multiple-form-submissions", | ||
}) do %> | ||
<%= render "govuk_publishing_components/components/input", { | ||
label: { | ||
text: "Enter the slug for the organisation", | ||
}, | ||
hint: "You can get the slug from the last part of the public URL - everything after '/government/organisations/'.", | ||
name: "organisation_slug", | ||
} %> | ||
<%= render "govuk_publishing_components/components/button", { | ||
text: "Continue", | ||
} %> | ||
<% end %> | ||
</section> | ||
</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
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,55 @@ | ||
Feature: Republishing published documents | ||
As an editor | ||
I want to be able to republish published documents | ||
So that they reflect changes to their dependencies when this doesn't happen automatically | ||
|
||
Background: | ||
Given I am a GDS admin | ||
|
||
Scenario: Republish the "Past Prime Ministers" page | ||
Given a published publication "Past Prime Ministers" exists | ||
And the "Past Prime Ministers" page can be republished | ||
When I request a republish of the "Past Prime Ministers" page | ||
Then I can see the "Past Prime Ministers" page has been scheduled for republishing | ||
|
||
Scenario: Republish the "How government works" page | ||
Given a published publication "How government works" exists | ||
And the "How government works" page can be republished | ||
When I request a republish of the "How government works" page | ||
Then I can see the "How government works" page has been scheduled for republishing | ||
|
||
Scenario: Republish the "Fields of operation" page | ||
Given a published publication "Fields of operation" exists | ||
And the "Fields of operation" page can be republished | ||
When I request a republish of the "Fields of operation" page | ||
Then I can see the "Fields of operation" page has been scheduled for republishing | ||
|
||
Scenario: Republish the "Ministers" page | ||
Given a published publication "Ministers" exists | ||
And the "Ministers" page can be republished | ||
When I request a republish of the "Ministers" page | ||
Then I can see the "Ministers" page has been scheduled for republishing | ||
|
||
Scenario: Republish the "Find a British embassy, high commission or consulate" page | ||
Given a published publication "Find a British embassy, high commission or consulate" exists | ||
And the "Find a British embassy, high commission or consulate" page can be republished | ||
When I request a republish of the "Find a British embassy, high commission or consulate" page | ||
Then I can see the "Find a British embassy, high commission or consulate" page has been scheduled for republishing | ||
|
||
Scenario: Republish the "Help and services around the world" page | ||
Given a published publication "Help and services around the world" exists | ||
And the "Help and services around the world" page can be republished | ||
When I request a republish of the "Help and services around the world" page | ||
Then I can see the "Help and services around the world" page has been scheduled for republishing | ||
|
||
Scenario: Republish the "Departments, agencies and public bodies" page | ||
Given a published publication "Departments, agencies and public bodies" exists | ||
And the "Departments, agencies and public bodies" page can be republished | ||
When I request a republish of the "Departments, agencies and public bodies" page | ||
Then I can see the "Departments, agencies and public bodies" page has been scheduled for republishing | ||
|
||
Scenario: Republish an organisation | ||
Given a published organisation "An Existing Organisation" exists | ||
And the "An Existing Organisation" organisation can be republished | ||
When I request a republish of the "An Existing Organisation" organisation | ||
Then I can see the "An Existing Organisation" organisation has been scheduled for republishing |
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
features/step_definitions/republishing_content_steps.rb.rb
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,50 @@ | ||
Given(/^the "([^"]*)" page can be republished$/) do |_page_title| | ||
create(:ministerial_role, name: "Prime Minister", cabinet_member: true) | ||
end | ||
|
||
When(/^I request a republish of the "([^"]*)" page$/) do |page_title| | ||
visit admin_republishing_index_path | ||
find(republishing_link_id_from_page_title(page_title)).click | ||
click_button("Confirm republishing") | ||
end | ||
|
||
Then(/^I can see the "([^"]*)" page has been scheduled for republishing/) do |page_title| | ||
expect(page).to have_selector(".gem-c-success-alert", text: "The '#{page_title}' page has been scheduled for republishing") | ||
end | ||
|
||
Given(/^a published organisation "An Existing Organisation" exists$/) do | ||
create(:organisation, name: "An Existing Organisation", slug: "an-existing-organisation") | ||
end | ||
|
||
Given(/^the "An Existing Organisation" organisation can be republished$/) do | ||
create(:ministerial_role, name: "Prime Minister", cabinet_member: true) | ||
end | ||
|
||
When(/^I request a republish of the "An Existing Organisation" organisation$/) do | ||
visit admin_republishing_index_path | ||
find("#republish-organisation").click | ||
fill_in "Enter the slug for the organisation", with: "an-existing-organisation" | ||
click_button("Continue") | ||
click_button("Confirm republishing") | ||
end | ||
|
||
Then(/^I can see the "An Existing Organisation" organisation has been scheduled for republishing/) do | ||
expect(page).to have_selector(".gem-c-success-alert", text: "The 'An Existing Organisation' organisation has been scheduled for republishing") | ||
end | ||
|
||
def republishing_link_id_from_page_title(page_title) | ||
link_id = "#republish-" | ||
|
||
link_id += case page_title | ||
when "Find a British embassy, high commission or consulate" | ||
"embassies" | ||
when "Help and services around the world" | ||
"world" | ||
when "Departments, agencies and public bodies" | ||
"organisations" | ||
else | ||
page_title.downcase.gsub(" ", "-") | ||
end | ||
|
||
link_id | ||
end |
13 changes: 0 additions & 13 deletions
13
features/step_definitions/republishing_published_documents_steps.rb.rb
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.