Skip to content

Commit 945b49c

Browse files
committed
Update to show new Explore Super Menu Header
For users who are in the B variant of the AB Test, they get a template from Static that has the new Explore Super-menu Navigation.
1 parent da3cec0 commit 945b49c

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

app/controllers/content_items_controller.rb

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
class ContentItemsController < ApplicationController
22
include GovukPersonalisation::AccountConcern
3+
include Slimmer::Template
4+
include AbTests::ExploreMenuAbTestable
5+
36
rescue_from GdsApi::HTTPForbidden, with: :error_403
47
rescue_from GdsApi::HTTPNotFound, with: :error_notfound
58
rescue_from GdsApi::HTTPGone, with: :error_410
@@ -10,6 +13,11 @@ class ContentItemsController < ApplicationController
1013
rescue_from PresenterBuilder::SpecialRouteReturned, with: :error_notfound
1114
rescue_from PresenterBuilder::GovernmentReturned, with: :error_notfound
1215

16+
before_action :set_explore_menu_response
17+
after_action :set_slimmer_template
18+
19+
helper_method :explore_menu_variant, :explore_menu_testable?
20+
1321
attr_accessor :content_item, :taxonomy_navigation
1422

1523
def show
@@ -47,6 +55,14 @@ def service_sign_in_options
4755

4856
private
4957

58+
def set_slimmer_template
59+
if explore_menu_testable?
60+
slimmer_template "core_layout_explore_header"
61+
else
62+
slimmer_template "core_layout"
63+
end
64+
end
65+
5066
def is_history_page?
5167
@content_item.document_type == "history"
5268
end

app/views/layouts/application.html.erb

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
<meta name="description" content="<%= strip_tags(@content_item.description) %>" />
2828
<% end %>
2929

30+
<%= explore_menu_variant.analytics_meta_tag.html_safe if explore_menu_testable? %>
31+
3032
<%= yield :extra_head_content %>
3133
</head>
3234
<body>
33-
<% unless content_for(:simple_header) %>
35+
<% unless content_for(:simple_header) || explore_menu_testable? %>
3436
<%= render 'govuk_publishing_components/components/government_navigation', active: active_proposition %>
3537
<% end %>
3638

test/controllers/content_items_controller_test.rb

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
class ContentItemsControllerTest < ActionController::TestCase
44
include GdsApi::TestHelpers::ContentStore
55
include GovukAbTesting::MinitestHelpers
6+
include AbTests::ExploreMenuAbTestable
67

78
test "routing handles paths with no format or locale" do
89
assert_routing(
@@ -366,6 +367,12 @@ class ContentItemsControllerTest < ActionController::TestCase
366367
assert_equal response.headers["Access-Control-Allow-Origin"], "*"
367368
end
368369

370+
test "request for Explore navigational super menu from slimmer" do
371+
content_item = content_store_has_schema_example("case_study", "case_study")
372+
get :show, params: { path: path_for(content_item) }
373+
assert_response_not_modified_for_ab_test(AbTests::ExploreMenuAbTestable)
374+
end
375+
369376
def path_for(content_item, locale = nil)
370377
base_path = content_item["base_path"].sub(/^\//, "")
371378
base_path.gsub!(/\.#{locale}$/, "") if locale

0 commit comments

Comments
 (0)