Module: WonderNavigation::Controller

Defined in:
lib/wonder_navigation/controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



4
5
6
7
# File 'lib/wonder_navigation/controller.rb', line 4

def self.included(controller)
  controller.before_action :set_default_wonder_navigation_page
  controller.before_action :set_current_wonder_navigation_menu
end

Instance Method Details

#set_current_wonder_navigation_menu(current_menu = :default) ⇒ Object



18
19
20
# File 'lib/wonder_navigation/controller.rb', line 18

def set_current_wonder_navigation_menu(current_menu = :default)
  @current_menu = current_menu
end

#set_default_wonder_navigation_pageObject



9
10
11
12
13
14
15
16
# File 'lib/wonder_navigation/controller.rb', line 9

def set_default_wonder_navigation_page
  page_action = case action_name.to_sym
                when :create then :new
                when :update then :edit
                else action_name
                end
  set_navigation_page "#{controller_path.tr('/','_')}_#{page_action}"
end

#set_navigation_page(navigation_page) ⇒ Object



26
27
28
# File 'lib/wonder_navigation/controller.rb', line 26

def set_navigation_page(navigation_page)
  @navigation_page = navigation_page.to_sym
end

#set_wonder_navigation_object(navigation_object) ⇒ Object



22
23
24
# File 'lib/wonder_navigation/controller.rb', line 22

def set_wonder_navigation_object(navigation_object)
  @navigation_object = navigation_object
end