Module: ApplicationHelper
- Defined in:
- lib/engine/app/helpers/application_helper.rb
Instance Method Summary collapse
- #content_menu(selected_section) ⇒ Object
- #edit_class ⇒ Object
- #redis_configuration_string ⇒ Object
- #remove_class ⇒ 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 21 22 |
# 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_index_path, selected_section: selected_section) section(name: 'content', title: 'Content', url: content_index_path, selected_section: selected_section) section(name: 'tasks', title: 'Tasks', url: tasks_path, selected_section: selected_section) section(name: 'notifications', title: 'Notifications', url: notifications_path, selected_section: selected_section) section(name: 'performance', title: 'Performance', url: performance_index_path, selected_section: selected_section) end end end |
#edit_class ⇒ Object
28 29 30 |
# File 'lib/engine/app/helpers/application_helper.rb', line 28 def edit_class 'btn btn-primary' end |
#redis_configuration_string ⇒ Object
32 33 34 |
# File 'lib/engine/app/helpers/application_helper.rb', line 32 def redis_configuration_string "#{backend.host}:#{backend.port}" end |
#remove_class ⇒ Object
24 25 26 |
# File 'lib/engine/app/helpers/application_helper.rb', line 24 def remove_class 'btn btn-danger' 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 |