Module: DmCore::Admin::ApplicationHelper
- Included in:
- AdminController
- Defined in:
- app/helpers/dm_core/admin/application_helper.rb
Instance Method Summary collapse
-
#admin_path_active_class?(*paths) ⇒ Boolean
stackoverflow.com/questions/8552763/best-way-to-highlight-current-page-in-rails-3-apply-a-css-class-to-links-con ——————————————————————————.
-
#is_current_controller(controller_name) ⇒ Object
——————————————————————————.
-
#switch_user(user) ⇒ Object
Switch to the different user ——————————————————————————.
Instance Method Details
#admin_path_active_class?(*paths) ⇒ Boolean
16 17 18 19 20 21 |
# File 'app/helpers/dm_core/admin/application_helper.rb', line 16 def admin_path_active_class?(*paths) active = false # paths.each { |path| active ||= current_page?(path) } paths.each { |path| active ||= request.url.include?(path) } active ? 'active' : nil end |
#is_current_controller(controller_name) ⇒ Object
10 11 12 |
# File 'app/helpers/dm_core/admin/application_helper.rb', line 10 def is_current_controller(controller_name) controller.controller_name == controller_name end |
#switch_user(user) ⇒ Object
Switch to the different user
5 6 7 |
# File 'app/helpers/dm_core/admin/application_helper.rb', line 5 def switch_user(user) sign_in(:user, user) end |