Module: Interage::ControllerActiveHelper
- Included in:
- ApplicationHelper
- Defined in:
- lib/interage/controller_active_helper.rb
Constant Summary collapse
- HTML_SHOW_CLASS =
ENV.fetch('CONTROLLER_SHOW_CLASS', 'show')
- HTML_ACTIVE_CLASS =
ENV.fetch('CONTROLLER_ACTIVE_CLASS', 'active')
Instance Method Summary collapse
- #action_class_active(*actions) ⇒ Object
- #controller_class_active(*controllers) ⇒ Object (also: #menu_active)
- #controller_class_active_show(*controllers) ⇒ Object
- #controller_class_show(*controllers) ⇒ Object (also: #menu_class_show)
- #current_action?(*actions) ⇒ Boolean
- #current_controller?(*controllers) ⇒ Boolean
Instance Method Details
#action_class_active(*actions) ⇒ Object
28 29 30 |
# File 'lib/interage/controller_active_helper.rb', line 28 def action_class_active(*actions) HTML_ACTIVE_CLASS if current_action?(*actions) end |
#controller_class_active(*controllers) ⇒ Object Also known as:
14 15 16 |
# File 'lib/interage/controller_active_helper.rb', line 14 def controller_class_active(*controllers) HTML_ACTIVE_CLASS if current_controller?(*controllers) end |
#controller_class_active_show(*controllers) ⇒ Object
8 9 10 11 12 |
# File 'lib/interage/controller_active_helper.rb', line 8 def controller_class_active_show(*controllers) return unless current_controller?(*controllers) "#{HTML_SHOW_CLASS} #{HTML_ACTIVE_CLASS}" end |
#controller_class_show(*controllers) ⇒ Object Also known as:
19 20 21 |
# File 'lib/interage/controller_active_helper.rb', line 19 def controller_class_show(*controllers) HTML_SHOW_CLASS if current_controller?(*controllers) end |
#current_action?(*actions) ⇒ Boolean
32 33 34 |
# File 'lib/interage/controller_active_helper.rb', line 32 def current_action?(*actions) Array.wrap(actions).include?("#{controller_name}/#{action_name}") end |
#current_controller?(*controllers) ⇒ Boolean
24 25 26 |
# File 'lib/interage/controller_active_helper.rb', line 24 def current_controller?(*controllers) Array.wrap(controllers).include?(params[:controller]) end |