Sha256: d483e0df67e9d7295d192442b48b1550f0ae973e29128d4e19a9ac251f728197

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

module DatabaseHelper
  def current_database
    session[:database].to_i
  end

  def databases
    Backend.databases.each do |database|
      database_option(database)
    end
  end

  def database_option(database)
    haml_tag :option, {selected: (database.to_i == current_database.to_i)} do
      haml_concat database
    end
  end

  def choose_database_select
    capture_haml do
      haml_tag :form, action: '/content/change_database', method: 'post' do
        haml_tag :div, class: 'form-group' do
          haml_tag :label, for: 'database_select' do
            haml_concat 'Select database'
          end

          haml_tag :select, id: 'database_select', name: 'database', class: 'selectpicker form-control', data: {style: 'btn-info'} do
            databases
          end
        end
      end

    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis_monitor-0.2 lib/engine/app/helpers/database_helper.rb