Sha256: 62d75ad4604307548beff221f41efc890dd9c949e81f4011f0a0583b1d35d45a

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 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

    def driver_control(driver)
      content_tag(:div, class: 'panel panel-default') do
        content_tag(:div, class: 'panel-heading') do
          "#{driver.class::NAME} #{t('.control_panel')}".html_safe
        end +
        content_tag(:div, class: 'panel-body') do
          render "extface/driver/#{driver.class.name.demodulize.underscore}/control"
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
extface-0.2.4 app/helpers/extface/application_helper.rb