Sha256: f6675b92499136920ce2c53292b1d6d88425b9f8fe08f31f1e93546df7da0424

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

Contents

module RedisMonitor
  module Helpers
    module LayoutsHelper
      def main_layout
        'layouts/main'.to_sym
      end

      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', 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

      def authorized_for?(action)
        Authorization.authorized_for?(action)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis_monitor-0.0.6 lib/helpers/layouts_helper.rb