Skip to content

Commit 9989b1f

Browse files
authored
Merge pull request #1043 from alphagov/reduce-number-of-related-links
Reduce number of related links to 3 as default
2 parents 17b6585 + 08d3d4c commit 9989b1f

File tree

6 files changed

+5
-21
lines changed

6 files changed

+5
-21
lines changed

app/services/most_popular_content.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class MostPopularContent
55

66
attr_reader :content_ids, :current_path, :filter_content_purpose_supergroup, :number_of_links
77

8-
def initialize(content_ids:, current_path:, filter_content_purpose_supergroup:, number_of_links: 5)
8+
def initialize(content_ids:, current_path:, filter_content_purpose_supergroup:, number_of_links: 3)
99
@content_ids = content_ids
1010
@current_path = current_path
1111
@filter_content_purpose_supergroup = filter_content_purpose_supergroup

app/services/most_recent_content.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class MostRecentContent
22
attr_reader :content_id, :current_path, :filter_taxon, :number_of_links
33

4-
def initialize(content_ids:, current_path:, filter_content_purpose_supergroup:, number_of_links: 5)
4+
def initialize(content_ids:, current_path:, filter_content_purpose_supergroup:, number_of_links: 3)
55
@content_ids = content_ids
66
@current_path = current_path
77
@filter_content_purpose_supergroup = filter_content_purpose_supergroup

app/views/shared/_taxonomy_navigation.html.erb

-8
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
inverse: true,
4646
items: taxonomy_navigation[:services][:promoted_content]
4747
} %>
48-
49-
<%= render "govuk_publishing_components/components/document_list", {
50-
items: taxonomy_navigation[:services][:documents]
51-
} %>
5248
</div>
5349
<% end %>
5450

@@ -93,10 +89,6 @@
9389
<% end %>
9490
</div>
9591
<% end %>
96-
97-
<%= render "govuk_publishing_components/components/document_list", {
98-
items: taxonomy_navigation[:news_and_communication][:documents]
99-
} %>
10092
</div>
10193
<% end %>
10294

test/integration/content_pages_navigation_test.rb

-8
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ class ContentPagesNavigationTest < ActionDispatch::IntegrationTest
9292
assert page.has_css?('.gem-c-highlight-boxes__title[data-track-category="ServicesHighlightBoxClicked"]', text: 'Free school meals form')
9393
assert page.has_css?('.gem-c-highlight-boxes__title[data-track-action="1"]', text: 'Free school meals form')
9494
assert page.has_css?('.gem-c-highlight-boxes__title[data-track-label="/government/publications/meals"]', text: 'Free school meals form')
95-
96-
assert page.has_css?('.gem-c-document-list__item a[data-track-category="ServicesDocumentListClicked"]', text: 'Free school meals form')
97-
assert page.has_css?('.gem-c-document-list__item a[data-track-action="1"]', text: 'Free school meals form')
98-
assert page.has_css?('.gem-c-document-list__item a[data-track-label="/government/publications/meals"]', text: 'Free school meals form')
9995
end
10096

10197
test "does not show the Services section if there is no tagged content" do
@@ -216,10 +212,6 @@ class ContentPagesNavigationTest < ActionDispatch::IntegrationTest
216212
assert page.has_css?('.gem-c-image-card__title-link[data-track-category="newsAndCommunicationsImageCardClicked"]', text: 'Free school meals form')
217213
assert page.has_css?('.gem-c-image-card__title-link[data-track-action="1"]', text: 'Free school meals form')
218214
assert page.has_css?('.gem-c-image-card__title-link[data-track-label="/government/publications/meals"]', text: 'Free school meals form')
219-
220-
assert page.has_css?('.gem-c-document-list__item a[data-track-category="newsAndCommunicationsDocumentListClicked"]', text: 'Free school meals form')
221-
assert page.has_css?('.gem-c-document-list__item a[data-track-action="1"]', text: 'Free school meals form')
222-
assert page.has_css?('.gem-c-document-list__item a[data-track-label="/government/publications/meals"]', text: 'Free school meals form')
223215
end
224216

225217
test "does not show the News and comms section if there is no tagged content" do

test/services/most_popular_content_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def taxon_content_ids
3838
end
3939
end
4040

41-
test 'requests five results by default' do
42-
assert_includes_params(count: 5) do
41+
test 'requests three results by default' do
42+
assert_includes_params(count: 3) do
4343
most_popular_content.fetch
4444
end
4545
end

test/support/rummager_helpers.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def stub_for_taxon_and_supergroup(reject_link, content_ids, results, filter_cont
1919

2020
params = {
2121
start: 0,
22-
count: 5,
22+
count: 3,
2323
fields: fields,
2424
filter_part_of_taxonomy_tree: content_ids,
2525
order: order_by,

0 commit comments

Comments
 (0)