Skip to content

Commit

Permalink
Merge pull request #2535 from alphagov/spike_notifications
Browse files Browse the repository at this point in the history
Add single page notification button to document collections
  • Loading branch information
hannako authored Aug 3, 2023
2 parents 1108378 + f766dc1 commit e504eca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/presenters/document_collection_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class DocumentCollectionPresenter < ContentItemPresenter
include ContentItem::Political
include ContentItem::TitleAndContext
include ContentItem::ContentsList
include ContentItem::SinglePageNotificationButton

def contents_items
groups.map do |group|
Expand Down
1 change: 1 addition & 0 deletions app/views/content_items/document_collection.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</div>

<%= render 'shared/publisher_metadata_with_logo' %>
<%= render 'shared/single_page_notification_button', content_item: @content_item, skip_account: "true" %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<% add_view_stylesheet("published-dates-button-group") %>
<% skip_account = skip_account || "false" %>

<%= render 'components/published_dates', {
published: @content_item.published,
Expand All @@ -13,6 +14,7 @@
js_enhancement: @has_govuk_account,
button_location: "bottom",
margin_bottom: 3,
skip_account: skip_account,
ga4_data_attributes: {
module: "ga4-link-tracker",
ga4_link: {
Expand All @@ -24,7 +26,7 @@
index_total: 2,
section: "Footer"
}
}
}
} if @content_item.has_single_page_notifications? %>
<%= render "govuk_publishing_components/components/print_link", {
margin_top: 0,
Expand Down
2 changes: 2 additions & 0 deletions app/views/shared/_single_page_notification_button.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
%>

<% ga4_data_attributes = ga4_data_attributes || default_ga4_data_attributes %>
<% skip_account = skip_account || "false" %>

<%= render 'govuk_publishing_components/components/single_page_notification_button', {
base_path: @content_item.base_path,
js_enhancement: @has_govuk_account,
ga4_data_attributes: ga4_data_attributes,
margin_bottom: 6,
button_location: "top",
skip_account: skip_account,
} if @content_item.has_single_page_notifications? %>
4 changes: 2 additions & 2 deletions test/integration/document_collection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ class DocumentCollectionTest < ActionDispatch::IntegrationTest
end
end

test "does not render with the single page notification button" do
test "renders with the single page notification button" do
setup_and_visit_content_item("document_collection")
assert_not page.has_css?(".gem-c-single-page-notification-button")
assert page.has_css?(".gem-c-single-page-notification-button")
end
end

0 comments on commit e504eca

Please sign in to comment.