Class: ApplicationFormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
app/helpers/application_form_builder.rb

Overview

This FormBuilder is the default for the application It'll use Bulma styling and build labelled form fields If you need a specific input not included here, please add it

Instance Method Summary collapse

Instance Method Details

#collection_select(*args) ⇒ Object

FormBuilder Overrides


62
63
64
65
66
# File 'app/helpers/application_form_builder.rb', line 62

def collection_select(*args)
  tag.div class: 'select' do
    super(*args)
  end
end

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

Field Overrides


41
42
43
# File 'app/helpers/application_form_builder.rb', line 41

def email_field(method, options = {})
  super(method, options.merge(class: 'input'))
end

#labelled_check_box(method, *input_options, label_options: {}) ⇒ Object


9
10
11
12
13
14
# File 'app/helpers/application_form_builder.rb', line 9

def labelled_check_box(method, *input_options, label_options: {})
  tag.div(class: 'field') do
    check_box(method, *input_options) +
      label(method, label_options)
  end
end

#labelled_collection_select(method, *input_options, label_options: {}) ⇒ Object


16
17
18
19
20
# File 'app/helpers/application_form_builder.rb', line 16

def labelled_collection_select(method, *input_options, label_options: {})
  form_controls(method, label_options) do
    collection_select(method, *input_options)
  end
end

#labelled_number_field(method, label_options: {}, input_options: {}) ⇒ Object


22
23
24
25
26
# File 'app/helpers/application_form_builder.rb', line 22

def labelled_number_field(method, label_options: {}, input_options: {})
  form_controls(method, label_options) do
    number_field(method, input_options)
  end
end

#labelled_text_area(method, label_options: {}, input_options: {}) ⇒ Object


28
29
30
31
32
# File 'app/helpers/application_form_builder.rb', line 28

def labelled_text_area(method, label_options: {}, input_options: {})
  form_controls(method, label_options) do
    text_area(method, input_options)
  end
end

#labelled_text_field(method, label_options: {}, input_options: {}) ⇒ Object


34
35
36
37
38
# File 'app/helpers/application_form_builder.rb', line 34

def labelled_text_field(method, label_options: {}, input_options: {})
  form_controls(method, label_options) do
    text_field(method, input_options)
  end
end

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


45
46
47
# File 'app/helpers/application_form_builder.rb', line 45

def number_field(method, options = {})
  super(method, options.merge(class: 'input'))
end

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


49
50
51
# File 'app/helpers/application_form_builder.rb', line 49

def password_field(method, options = {})
  super(method, options.merge(class: 'input'))
end

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


68
69
70
# File 'app/helpers/application_form_builder.rb', line 68

def submit(value = nil, options = {})
  super(value, options.merge(class: 'button is-primary'))
end

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


53
54
55
# File 'app/helpers/application_form_builder.rb', line 53

def text_area(method, options = {})
  super(method, options.merge(class: 'textarea'))
end

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


57
58
59
# File 'app/helpers/application_form_builder.rb', line 57

def text_field(method, options = {})
  super(method, options.merge(class: 'input'))
end