Sha256: 0a5dda0d1fc69aeb04f1e1fa0541d48b34f846c66abbc39476e220d8185f331e

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

module ApplicationHelper
  def selected_is_selected(section, selected)
    'active' if section == selected
  end

  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

  def content_menu(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

  def remove_class
    'btn btn-danger'
  end

  def edit_class
    'btn btn-primary'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redis_monitor-0.3.2 lib/engine/app/helpers/application_helper.rb
redis_monitor-0.3 lib/engine/app/helpers/application_helper.rb