module TabsOnRails::ActionController
Protected Instance Methods
current_tab(namespace = nil)
click to toggle source
Returns the value for current tab in the default namespace, or nil if no tab has been set before. You can pass namespace
to get the value of the current tab for a different namespace.
Examples
current_tab # => nil current_tab :menu # => nil set_tab :homepage set_tab :dashboard, :menu current_tab # => :homepage current_tab :menu # => :dashboard
Returns the String/Symbol current tab.
# File lib/tabs_on_rails/action_controller.rb, line 55 def current_tab(namespace = nil) tab_stack[namespace || :default] end
current_tab?(name, namespace = nil)
click to toggle source
Checks if the current tab in namespace
matches name
.
Returns a Boolean.
# File lib/tabs_on_rails/action_controller.rb, line 63 def current_tab?(name, namespace = nil) current_tab(namespace).to_s == name.to_s end
set_tab(name, namespace = nil)
click to toggle source
Sets the value for current tab to given name. If you need to manage multiple tabs, then you can pass an optional namespace.
Examples
set_tab :homepage set_tab :dashboard, :menu
Returns nothing.
# File lib/tabs_on_rails/action_controller.rb, line 34 def set_tab(name, namespace = nil) tab_stack[namespace || :default] = name end
tab_stack()
click to toggle source
Initializes and/or returns the tab stack. You won't probably need to use this method directly unless you are trying to hack the plugin architecture.
Returns the Hash stack.
# File lib/tabs_on_rails/action_controller.rb, line 72 def tab_stack @tab_stack ||= {} end