Skip to content

Commit add23db

Browse files
steventuxSteve Laing
authored and
Steve Laing
committed
Add a link to Statutory Instruments finder at foot of content.
1 parent 2396f35 commit add23db

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

app/presenters/specialist_document_presenter.rb

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def will_continue_on
4646
.try(:html_safe)
4747
end
4848

49+
def finder_link
50+
if finder && statutory_instrument?
51+
link_to "See all #{finder['title']}", finder['base_path']
52+
end
53+
end
54+
4955
private
5056

5157
def nested_headers
@@ -206,4 +212,8 @@ def any_updates?
206212
def bulk_published?
207213
!!facet_values["bulk_published"]
208214
end
215+
216+
def statutory_instrument?
217+
content_item["document_type"] == "statutory_instrument"
218+
end
209219
end

app/views/content_items/specialist_document.html.erb

+7
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444
history: @content_item.history
4545
} %>
4646
</div>
47+
48+
<% if @content_item.finder_link %>
49+
<div class="responsive-bottom-margin">
50+
<%= @content_item.finder_link %>
51+
</div>
52+
<% end %>
53+
4754
<% end %>
4855
</div>
4956
<%= render 'shared/sidebar_navigation' %>

test/integration/specialist_document_test.rb

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class SpecialistDocumentTest < ActionDispatch::IntegrationTest
1818
setup_and_visit_content_item('employment-appeal-tribunal-decision')
1919
setup_and_visit_content_item('employment-tribunal-decision')
2020
setup_and_visit_content_item('european-structural-investment-funds')
21+
setup_and_visit_content_item('eu-withdrawal-act-2018-statutory-instruments')
2122
setup_and_visit_content_item('international-development-funding')
2223
setup_and_visit_content_item('maib-reports')
2324
setup_and_visit_content_item('raib-reports')
@@ -168,4 +169,14 @@ def assert_nested_content_item(heading)
168169

169170
refute page.has_css?('#contents .gem-c-contents-list')
170171
end
172+
173+
test 'renders a link to statutory instruments finder' do
174+
# Statutory instruments are tagged to taxonomy so stub rummager request for similar content
175+
# which is triggered by the sidebar component.
176+
stub_request(:get, /\/search.json/).to_return(status: 200, body: "{}", headers: {})
177+
setup_and_visit_content_item('eu-withdrawal-act-2018-statutory-instruments')
178+
179+
assert page.has_css?("a[href='/eu-withdrawal-act-2018-statutory-instruments']",
180+
text: 'See all EU Withdrawal Act 2018 statutory instruments')
181+
end
171182
end

0 commit comments

Comments
 (0)