Module: ApplicationHelper
- Defined in:
- lib/engine/app/helpers/application_helper.rb
Instance Method Summary collapse
- #content_menu(selected_section) ⇒ Object
- #section(opts = {}) ⇒ Object
- #selected_is_selected(section, selected) ⇒ Object
Instance Method Details
#content_menu(selected_section) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/engine/app/helpers/application_helper.rb', line 12 def (selected_section) capture_haml do haml_tag :ul, class: 'nav navbar-nav' do section(name: 'info', title: 'Info', url: '/info', selected_section: selected_section) section(name: 'content', title: 'Content', url: '/content', selected_section: selected_section) section(name: 'performance', title: 'Performance', url: '/performance', selected_section: selected_section) end end end |
#section(opts = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/engine/app/helpers/application_helper.rb', line 6 def section(opts = {}) haml_tag :li, class: selected_is_selected(opts[:name], opts[:selected_section]) do haml_tag :a, opts[:title], href: opts[:url] end end |
#selected_is_selected(section, selected) ⇒ Object
2 3 4 |
# File 'lib/engine/app/helpers/application_helper.rb', line 2 def selected_is_selected(section, selected) 'active' if section == selected end |