Skip to content

Instantly share code, notes, and snippets.

@kylefox
Created April 16, 2010 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylefox/368812 to your computer and use it in GitHub Desktop.
Save kylefox/368812 to your computer and use it in GitHub Desktop.
# Renders a menu: http://gist.github.com/368818
# Returns a symbol indicating which of the main tabs is active, based on the current controller.
def get_main_tab
subtab = controller_name.to_sym
tab = case subtab
when :landing then :home
when :users then :users
when :exams, :items, :topics then :exams
when :pages, :menus, :files, :email_templates then :content
when :settings, :themes then :settings
end
if subtab == :settings
subtab = "#{controller.action_name}_settings".to_sym
elsif subtab == :users
subtab = controller.action_name.to_sym
end
[tab, subtab]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment