Skip to content

Commit c7dcb70

Browse files
committed
Show step by step sidebar on Whitehall content
We're hiding the sidebar on whitehall content in the AB test. The exception to this is when it's a step by step.
1 parent 5e8abb3 commit c7dcb70

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

app/controllers/concerns/content_pages_nav_ab_testable.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def has_a_live_taxon?
5151
end
5252

5353
def should_show_sidebar?
54-
content_pages_nav_test_variant.variant?("A") || @content_item.content_item.parsed_content['publishing_app'] != "whitehall"
54+
content_pages_nav_test_variant.variant?("A") ||
55+
@content_item.step_by_steps.present? ||
56+
@content_item.content_item.parsed_content['publishing_app'] != "whitehall"
5557
end
5658
end

app/presenters/content_item_presenter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ContentItemPresenter
1212
:phase,
1313
:part_slug,
1414
:document_type,
15+
:step_by_steps,
1516
:taxons
1617

1718
attr_accessor :include_collections_in_other_publisher_metadata
@@ -27,6 +28,7 @@ def initialize(content_item, requested_content_item_path = nil)
2728
@phase = content_item["phase"]
2829
@document_type = content_item["document_type"]
2930
@taxons = content_item["links"]["taxons"] if content_item["links"]
31+
@step_by_steps = content_item["links"]["part_of_step_navs"] if content_item["links"]
3032
@part_slug = requesting_a_part? ? requested_content_item_path.split('/').last : nil
3133
end
3234

test/controllers/content_pages_nav_ab_testable_test.rb

+8
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ class ContentItemsControllerTest < ActionController::TestCase
7777
refute @controller.should_show_sidebar?
7878
end
7979

80+
test "should_show_sidebar? is true when tagged to a step by step even for whitehall content" do
81+
content_item = content_store_has_schema_example("guide", "guide-with-step-navs").merge("publishing_app" => "whitehall")
82+
setup_ab_variant("ContentPagesNav", "B")
83+
get :show, params: { path: path_for(content_item) }
84+
85+
assert @controller.should_show_sidebar?
86+
end
87+
8088
def ensure_ab_test_is_correctly_setup(test_variant, content_item)
8189
content_store_has_item(content_item['base_path'], content_item)
8290

0 commit comments

Comments
 (0)