File tree 3 files changed +26
-1
lines changed
3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
class ContentItemsController < ApplicationController
2
2
include GovukPersonalisation ::AccountConcern
3
+ include Slimmer ::Template
4
+ include AbTests ::ExploreMenuAbTestable
5
+
3
6
rescue_from GdsApi ::HTTPForbidden , with : :error_403
4
7
rescue_from GdsApi ::HTTPNotFound , with : :error_notfound
5
8
rescue_from GdsApi ::HTTPGone , with : :error_410
@@ -10,6 +13,11 @@ class ContentItemsController < ApplicationController
10
13
rescue_from PresenterBuilder ::SpecialRouteReturned , with : :error_notfound
11
14
rescue_from PresenterBuilder ::GovernmentReturned , with : :error_notfound
12
15
16
+ before_action :set_explore_menu_response
17
+ after_action :set_slimmer_template
18
+
19
+ helper_method :explore_menu_variant , :explore_menu_testable?
20
+
13
21
attr_accessor :content_item , :taxonomy_navigation
14
22
15
23
def show
@@ -47,6 +55,14 @@ def service_sign_in_options
47
55
48
56
private
49
57
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
+
50
66
def is_history_page?
51
67
@content_item . document_type == "history"
52
68
end
Original file line number Diff line number Diff line change 27
27
< meta name ="description " content ="<%= strip_tags ( @content_item . description ) %> " />
28
28
<% end %>
29
29
30
+ <%= explore_menu_variant . analytics_meta_tag . html_safe if explore_menu_testable? %>
31
+
30
32
<%= yield :extra_head_content %>
31
33
</ head >
32
34
< body >
33
- <% unless content_for ( :simple_header ) %>
35
+ <% unless content_for ( :simple_header ) || explore_menu_testable? %>
34
36
<%= render 'govuk_publishing_components/components/government_navigation' , active : active_proposition %>
35
37
<% end %>
36
38
Original file line number Diff line number Diff line change 3
3
class ContentItemsControllerTest < ActionController ::TestCase
4
4
include GdsApi ::TestHelpers ::ContentStore
5
5
include GovukAbTesting ::MinitestHelpers
6
+ include AbTests ::ExploreMenuAbTestable
6
7
7
8
test "routing handles paths with no format or locale" do
8
9
assert_routing (
@@ -366,6 +367,12 @@ class ContentItemsControllerTest < ActionController::TestCase
366
367
assert_equal response . headers [ "Access-Control-Allow-Origin" ] , "*"
367
368
end
368
369
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
+
369
376
def path_for ( content_item , locale = nil )
370
377
base_path = content_item [ "base_path" ] . sub ( /^\/ / , "" )
371
378
base_path . gsub! ( /\. #{ locale } $/ , "" ) if locale
You can’t perform that action at this time.
0 commit comments