Skip to content

Commit

Permalink
Add notification button to detailed guide template
Browse files Browse the repository at this point in the history
  • Loading branch information
danacotoran committed Dec 7, 2021
1 parent c16a181 commit c6d3087
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
5 changes: 4 additions & 1 deletion app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def render_template
end

# use these and `@content_item.base_path` in the template
@notification_button_visible = in_single_page_notifications_trial?
@notification_button_visible = in_single_page_notifications_trial? && !@content_item.brexit_child_taxon
@include_single_page_notification_button_js = account_session_header.present?

request.variant = :print if params[:variant] == "print"
Expand Down Expand Up @@ -216,6 +216,9 @@ def in_single_page_notifications_trial?
%w[
/government/publications/open-standards-for-government
/government/publications/identity-proofing-and-verification-of-an-individual
/guidance/travel-to-england-from-another-country-during-coronavirus-covid-19
/guidance/covid-19-coronavirus-restrictions-what-you-can-and-cannot-do
/government/publications/face-coverings-when-to-wear-one-and-how-to-make-your-own
].include? @content_item.base_path
end
end
11 changes: 10 additions & 1 deletion app/views/content_items/detailed_guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
</div>

<%= render 'shared/publisher_metadata_with_logo' unless brexit_child_taxon %>

<%= render 'shared/history_notice', content_item: @content_item %>
<%= render 'govuk_publishing_components/components/notice', @content_item.withdrawal_notice_component %>

Expand Down Expand Up @@ -65,8 +66,16 @@
<%= render 'components/published-dates', {
published: @content_item.published,
last_updated: @content_item.updated,
history: @content_item.history
history: @content_item.history,
margin_bottom: 3,
} unless brexit_child_taxon %>

<%= render 'govuk_publishing_components/components/single_page_notification_button', {
base_path: @content_item.base_path,
js_enhancement: @include_single_page_notification_button_js,
button_location: "bottom",
margin_bottom: 0,
} if @notification_button_visible %>
</div>
<% end %>
<%= render "govuk_publishing_components/components/print_link", {
Expand Down
7 changes: 1 addition & 6 deletions app/views/content_items/publication.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
</div>

<%= render 'shared/publisher_metadata_with_logo' %>
<%= render 'govuk_publishing_components/components/single_page_notification_button', {
base_path: @content_item.base_path,
js_enhancement: @include_single_page_notification_button_js,
margin_bottom: 6,
button_location: "top",
} if @notification_button_visible %>

<%= render 'shared/history_notice', content_item: @content_item %>

<%= render 'govuk_publishing_components/components/notice', @content_item.withdrawal_notice_component %>
Expand Down
7 changes: 7 additions & 0 deletions app/views/shared/_publisher_metadata_with_logo.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@
</div>
</div>
</div>

<%= render 'govuk_publishing_components/components/single_page_notification_button', {
base_path: @content_item.base_path,
js_enhancement: @include_single_page_notification_button_js,
margin_bottom: 6,
button_location: "top",
} if @notification_button_visible %>

0 comments on commit c6d3087

Please sign in to comment.