Module: BackboneAXSwitch::BootstrapView

Included in:
Sprockets::Helpers::RailsHelper
Defined in:
lib/backboneAXSwitch/bootstrap_view.rb

Instance Method Summary collapse

Instance Method Details

#bx_cg_switch(label, field_id, options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/backboneAXSwitch/bootstrap_view.rb', line 19

def bx_cg_switch(label, field_id, options = {})
  bx_cg_group(label, field_id, options) do
    haml_tag(:div, options.merge({class: 'switch', id: field_id})) do
      haml_tag(:div, {class: 'cb-enable'}) do 
        haml_tag(:span, 'On')
      end
      haml_tag(:div, {class: 'cb-disable'}) do 
        haml_tag(:span, 'Off')
      end
      haml_tag(:input, options.merge({class: 'hide', type: 'checkbox', id: field_id}))        
    end
  end
end

#bx_field_switch(label, field_id, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/backboneAXSwitch/bootstrap_view.rb', line 4

def bx_field_switch(label, field_id, options = {})
  capture_haml do
    haml_tag(:div, options.merge({class: 'switch', id: field_id})) do
      haml_tag(:div, {class: 'cb-enable'}) do 
        haml_tag(:span, 'On')
      end
      haml_tag(:div, {class: 'cb-disable'}) do 
        haml_tag(:span, 'Off')
      end
      haml_tag(:input, options.merge({class: 'hide', type: 'checkbox', id: field_id}))        
    end
  end
end