diff --git a/app/controllers/test_feature_toggle_controller.rb b/app/controllers/test_feature_toggle_controller.rb new file mode 100644 index 00000000000..73ec739a4a9 --- /dev/null +++ b/app/controllers/test_feature_toggle_controller.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class TestFeatureToggleController < ApplicationController + before_action -> { authorize_feature(:test_feature_toggle, [User.find_by(login_name: 'kimura'), User.admins]) } + before_action -> { authorized_feature!(:test_feature_toggle) } + def index + @user = User.first + end +end diff --git a/app/views/application/_global_nav.slim b/app/views/application/_global_nav.slim index 1a789791186..6fb7aa8d806 100644 --- a/app/views/application/_global_nav.slim +++ b/app/views/application/_global_nav.slim @@ -72,3 +72,9 @@ nav.global-nav .global-nav__item-count.a-notification-count.is-only-mentor = Talk.action_uncompleted.count .global-nav-links__link-label 相談 + - if authorized_feature?(:test_feature_toggle) + li.global-nav-links__item + = link_to test_feature_toggle_index_path, class: "global-nav-links__link #{current_link(/^events|^regular_events/)}" do + .global-nav-links__link-icon + i.fa-solid.fa-beer + .global-nav-links__link-label FeatureToggle diff --git a/app/views/test_feature_toggle/index.html.slim b/app/views/test_feature_toggle/index.html.slim new file mode 100644 index 00000000000..b5b309856b4 --- /dev/null +++ b/app/views/test_feature_toggle/index.html.slim @@ -0,0 +1 @@ += @user.name diff --git a/config/routes.rb b/config/routes.rb index cf5d71ed68f..9e6a54da093 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -132,4 +132,7 @@ resources :movies mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? mount GoodJob::Engine => 'good_job' + + # routes for testing feature toggle on staging env + resources :test_feature_toggle, only: %i(index) end