Skip to content

Commit

Permalink
Merge pull request #1063 from alphagov/show-step-by-step-sidebar
Browse files Browse the repository at this point in the history
Show step by step sidebar on Whitehall content
  • Loading branch information
sihugh authored Aug 29, 2018
2 parents 5e8abb3 + c7dcb70 commit 5f96aa8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/concerns/content_pages_nav_ab_testable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def has_a_live_taxon?
end

def should_show_sidebar?
content_pages_nav_test_variant.variant?("A") || @content_item.content_item.parsed_content['publishing_app'] != "whitehall"
content_pages_nav_test_variant.variant?("A") ||
@content_item.step_by_steps.present? ||
@content_item.content_item.parsed_content['publishing_app'] != "whitehall"
end
end
2 changes: 2 additions & 0 deletions app/presenters/content_item_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ContentItemPresenter
:phase,
:part_slug,
:document_type,
:step_by_steps,
:taxons

attr_accessor :include_collections_in_other_publisher_metadata
Expand All @@ -27,6 +28,7 @@ def initialize(content_item, requested_content_item_path = nil)
@phase = content_item["phase"]
@document_type = content_item["document_type"]
@taxons = content_item["links"]["taxons"] if content_item["links"]
@step_by_steps = content_item["links"]["part_of_step_navs"] if content_item["links"]
@part_slug = requesting_a_part? ? requested_content_item_path.split('/').last : nil
end

Expand Down
8 changes: 8 additions & 0 deletions test/controllers/content_pages_nav_ab_testable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ class ContentItemsControllerTest < ActionController::TestCase
refute @controller.should_show_sidebar?
end

test "should_show_sidebar? is true when tagged to a step by step even for whitehall content" do
content_item = content_store_has_schema_example("guide", "guide-with-step-navs").merge("publishing_app" => "whitehall")
setup_ab_variant("ContentPagesNav", "B")
get :show, params: { path: path_for(content_item) }

assert @controller.should_show_sidebar?
end

def ensure_ab_test_is_correctly_setup(test_variant, content_item)
content_store_has_item(content_item['base_path'], content_item)

Expand Down

0 comments on commit 5f96aa8

Please sign in to comment.