-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add help_page controller and update content item model to support hel…
…p_page - Add new route - Add help_page controller - Update content item model - Add help_page views - Add system spec for the new help_page Commit audit trail: - spec/system/help_page_spec.rb https://github.com/alphagov/government-frontend/blob/af54031948650448b965ac274c3248d23658c4f6/test/integration/help_page_test.rb - app/views/help_page/show.html.erb https://github.com/alphagov/government-frontend/blob/af54031948650448b965ac274c3248d23658c4f6/app/views/content_items/help_page.html.erb
- Loading branch information
1 parent
2e0bf83
commit d04f2ee
Showing
8 changed files
with
100 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class HelpPageController < ContentItemsController | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<% content_for :extra_head_content do %> | ||
<%= render "govuk_publishing_components/components/machine_readable_metadata", { content_item: @content_item.to_h, schema: :article } %> | ||
<% end %> | ||
|
||
<% if @content_item.base_path == '/help/cookie-details' %> | ||
<meta name="robots" content="noindex"> | ||
<% end %> | ||
|
||
<%= render 'shared/body_with_related_links' %> |
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,29 @@ | ||
<% content_for :simple_header, true %> | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= render 'govuk_publishing_components/components/title', | ||
title: @content_item.title %> | ||
</div> | ||
</div> | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<div class="responsive-bottom-margin"> | ||
|
||
<%= render 'govuk_publishing_components/components/govspeak', { | ||
direction: page_text_direction, | ||
disable_youtube_expansions: true, | ||
} do %> | ||
<%= raw(@content_item.body) %> | ||
<% end %> | ||
|
||
<% if @content_item.last_updated && @content_item.schema_name == "help_page" %> | ||
<%= render "components/published_dates", { | ||
last_updated: display_date(@content_item.last_updated) | ||
} %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<%= render 'shared/sidebar_navigation' %> | ||
</div> | ||
|
||
<%= render 'shared/footer_navigation' %> |
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,43 @@ | ||
RSpec.describe "HelpPage" do | ||
let(:base_path) { "/help/about-govuk" } | ||
let(:title) { "About GOV.UK" } | ||
let(:body) { "<p>GOV.UK is the website for the UK government. It’s the best place to find government services and information.</p>" } | ||
|
||
let(:payload) do | ||
{ | ||
base_path:, | ||
format: "help_page", | ||
title:, | ||
details: { body: }, | ||
} | ||
end | ||
|
||
before do | ||
stub_content_store_has_item(base_path, payload) | ||
end | ||
|
||
it "displays the help page" do | ||
visit base_path | ||
|
||
expect(page).to have_title("#{title} - GOV.UK") | ||
expect(page).to have_css("h1", text: title) | ||
expect(page).to have_text("GOV.UK is the website for the UK government. It’s the best place to find government services and information.") | ||
end | ||
|
||
context "when visiting '/help/cookie-details'" do | ||
let(:base_path) { "/help/cookie-details" } | ||
let(:title) { "Details about cookies on GOV.UK" } | ||
|
||
it "sets noindex meta tag" do | ||
visit base_path | ||
|
||
expect(page).to have_css('meta[name="robots"][content="noindex"]', visible: false) | ||
end | ||
|
||
it "does not render with the single page notification button" do | ||
visit base_path | ||
|
||
expect(page).not_to have_css(".gem-c-single-page-notification-button") | ||
end | ||
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