Allow specifying navigation tab for controllers

This commit is contained in:
2024-05-06 19:01:54 +02:00
parent 965cb76f1d
commit aa83f17a4c
3 changed files with 20 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ class ApplicationController < ActionController::Base
# used, or custom layout method needs to be defined.
helper_method :current_user_disguised?
helper_method :current_tab
before_action :authenticate_user!
@@ -42,6 +43,16 @@ class ApplicationController < ActionController::Base
new_user_session_path
end
class << self
attr_reader :navigation_menu_tab
def navigation_tab(name)
@navigation_menu_tab = name.to_s
end
end
def current_tab
self.class.navigation_menu_tab || controller_name
end
private
def rescue_turbo(exception)