Sha256: 258f38421c8773cef29932b9e5b78773762eea1a2729b470549c131332932685

Contents?: true

Size: 1.08 KB

Versions: 21

Compression:

Stored size: 1.08 KB

Contents

module Extface
  module ApplicationHelper

    def bootstrap_class_for flash_type
      case flash_type
        when :success
          "alert-success"
        when :error
          "alert-danger"
        when :alert
          "alert-warning"
        when :notice
          "alert-info"
        else
          flash_type.to_s
      end
    end
    
    def form_group(f, field, control, options = {})
      content_tag(:div, class: 'form-group') do
        f.label(field, class: 'col-sm-2 control-label') +
        content_tag(:div, class: 'col-sm-10 col-md-8') do
          f.send(control, field, options.merge( class: "form-control #{options[:class]}"))
        end
      end
    end
    
    def driver_settings(form, driver)
      content_tag(:div, class: 'panel panel-default') do
        content_tag(:div, class: 'panel-heading') do
          "#{driver.class::NAME} #{t('.settings')}".html_safe
        end +
        content_tag(:div, class: 'panel-body') do
          render "extface/driver/#{driver.class.name.demodulize.underscore}/settings", form: form
        end
      end
    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
extface-0.2.3 app/helpers/extface/application_helper.rb
extface-0.2.2 app/helpers/extface/application_helper.rb
extface-0.2.1 app/helpers/extface/application_helper.rb
extface-0.2.0 app/helpers/extface/application_helper.rb
extface-0.1.9 app/helpers/extface/application_helper.rb
extface-0.1.8 app/helpers/extface/application_helper.rb
extface-0.1.7 app/helpers/extface/application_helper.rb
extface-0.1.6 app/helpers/extface/application_helper.rb
extface-0.1.5 app/helpers/extface/application_helper.rb
extface-0.1.4 app/helpers/extface/application_helper.rb
extface-0.1.3 app/helpers/extface/application_helper.rb
extface-0.1.2 app/helpers/extface/application_helper.rb
extface-0.1.1 app/helpers/extface/application_helper.rb
extface-0.1.0 app/helpers/extface/application_helper.rb
extface-0.0.8 app/helpers/extface/application_helper.rb
extface-0.0.7 app/helpers/extface/application_helper.rb
extface-0.0.6 app/helpers/extface/application_helper.rb
extface-0.0.5 app/helpers/extface/application_helper.rb
extface-0.0.3 app/helpers/extface/application_helper.rb
extface-0.0.2 app/helpers/extface/application_helper.rb