Module: Dbviewer::NavigationHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/dbviewer/navigation_helper.rb
Instance Method Summary collapse
-
#active_nav_class(controller_name, action_name = nil) ⇒ Object
Helper method to determine if current controller and action match.
-
#dashboard_nav_class ⇒ Object
Helper for highlighting dashboard link.
-
#erd_nav_class ⇒ Object
Helper for highlighting ERD link.
-
#logs_nav_class ⇒ Object
Helper for highlighting SQL Logs link.
-
#tables_nav_class ⇒ Object
Helper for highlighting tables link.
Instance Method Details
#active_nav_class(controller_name, action_name = nil) ⇒ Object
Helper method to determine if current controller and action match
4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/dbviewer/navigation_helper.rb', line 4 def active_nav_class(controller_name, action_name = nil) current_controller = params[:controller].split("/").last active = current_controller == controller_name if action_name.present? active = active && params[:action] == action_name end active ? "active" : "" end |
#dashboard_nav_class ⇒ Object
Helper for highlighting dashboard link
16 17 18 |
# File 'app/helpers/dbviewer/navigation_helper.rb', line 16 def dashboard_nav_class active_nav_class("home") end |
#erd_nav_class ⇒ Object
Helper for highlighting ERD link
26 27 28 |
# File 'app/helpers/dbviewer/navigation_helper.rb', line 26 def erd_nav_class active_nav_class("entity_relationship_diagrams") end |
#logs_nav_class ⇒ Object
Helper for highlighting SQL Logs link
31 32 33 |
# File 'app/helpers/dbviewer/navigation_helper.rb', line 31 def logs_nav_class active_nav_class("logs") end |
#tables_nav_class ⇒ Object
Helper for highlighting tables link
21 22 23 |
# File 'app/helpers/dbviewer/navigation_helper.rb', line 21 def tables_nav_class active_nav_class("tables") end |