Created
April 16, 2010 19:14
-
-
Save kylefox/368812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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