Class: MissionControl::Web::BulmaFormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
lib/mission_control/web/bulma_form_builder.rb

Overview

Instance Method Summary collapse

Instance Method Details

#div_controlObject



26
27
28
29
30
# File 'lib/mission_control/web/bulma_form_builder.rb', line 26

def div_control
  @template.(:div, class: "control") do
    yield
  end
end

#label_check_box(method, text = nil, options = {}, &block) ⇒ Object



8
9
10
# File 'lib/mission_control/web/bulma_form_builder.rb', line 8

def label_check_box(method, text = nil, options = {}, &block)
  label(method, text, merge_class(options, "checkbox"), &block)
end

#label_default(method, text = nil, options = {}, &block) ⇒ Object



4
5
6
# File 'lib/mission_control/web/bulma_form_builder.rb', line 4

def label_default(method, text = nil, options = {}, &block)
  label(method, text, merge_class(options, "label"), &block)
end

#select(method, choices = nil, options = {}, html_options = {}, &block) ⇒ Object



36
37
38
39
40
# File 'lib/mission_control/web/bulma_form_builder.rb', line 36

def select(method, choices = nil, options = {}, html_options = {}, &block)
  label(method, class: "select") do
    super
  end
end

#select_with_label(method, choices = nil, options = {}, html_options = {}, &block) ⇒ Object



32
33
34
# File 'lib/mission_control/web/bulma_form_builder.rb', line 32

def select_with_label(method, choices = nil, options = {}, html_options = {}, &block)
  label_default(method) + select(method, choices, options, html_options, &block)
end

#submit(value = nil, options = {}) ⇒ Object



16
17
18
19
20
# File 'lib/mission_control/web/bulma_form_builder.rb', line 16

def submit(value = nil, options = {})
  div_control do
    super(value, merge_class(options, "button"))
  end
end

#submit_primary(value = nil, options = {}) ⇒ Object



22
23
24
# File 'lib/mission_control/web/bulma_form_builder.rb', line 22

def submit_primary(value = nil, options = {})
  submit(value, merge_class(options, "is-primary"))
end

#text_field(method, options = {}) ⇒ Object



12
13
14
# File 'lib/mission_control/web/bulma_form_builder.rb', line 12

def text_field(method, options = {})
  super(method, merge_class(options, "input"))
end