Module: Releaf::Builders::FormBuilder::TextFields

Included in:
Fields
Defined in:
app/builders/releaf/builders/form_builder/text_fields.rb

Instance Method Summary collapse

Instance Method Details

#releaf_email_field(name, input: {}, label: {}, field: {}, options: {}, &block) ⇒ Object



17
18
19
20
21
# File 'app/builders/releaf/builders/form_builder/text_fields.rb', line 17

def releaf_email_field(name, input: {}, label: {}, field: {}, options: {}, &block)
  options = {field: {type: "email"}}.deep_merge(options)
  input = {type: "email"}.deep_merge(input)
  releaf_text_field(name, input: input, label: label, field: field, options: options, &block)
end


23
24
25
26
# File 'app/builders/releaf/builders/form_builder/text_fields.rb', line 23

def releaf_link_field(name, input: {}, label: {}, field: {}, options: {}, &block)
  options = {field: {type: "link"}}.deep_merge(options)
  releaf_text_field(name, input: input, label: label, field: field, options: options, &block)
end

#releaf_password_field(name, input: {}, label: {}, field: {}, options: {}, &block) ⇒ Object



28
29
30
31
32
33
34
# File 'app/builders/releaf/builders/form_builder/text_fields.rb', line 28

def releaf_password_field(name, input: {}, label: {}, field: {}, options: {}, &block)
  attributes = input_attributes(name, {autocomplete: "off", class: "text"}.merge(input), options)
  options = {field: {type: "password"}}.deep_merge(options)
  content = password_field(name, attributes)

  input_wrapper_with_label(name, content, label: label, field: field, options: options, &block)
end

#releaf_text_field(name, input: {}, label: {}, field: {}, options: {}, &block) ⇒ Object



36
37
38
39
40
41
42
# File 'app/builders/releaf/builders/form_builder/text_fields.rb', line 36

def releaf_text_field(name, input: {}, label: {}, field: {}, options: {}, &block)
  attributes = input_attributes(name, {value: object.send(name), class: "text"}.merge(input), options)
  options = {field: {type: "text"}}.deep_merge(options)
  content = text_field(name, attributes)

  input_wrapper_with_label(name, content, label: label, field: field, options: options, &block)
end

#releaf_textarea_field(name, input: {}, label: {}, field: {}, options: {}, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/builders/releaf/builders/form_builder/text_fields.rb', line 2

def releaf_textarea_field(name, input: {}, label: {}, field: {}, options: {}, &block)
  attributes = {
    rows: 5,
    cols: 75,
    value: object.send(name)
  }.merge(input)

  attributes = input_attributes(name, attributes, options)

  options = {field: {type: "textarea"}}.deep_merge(options)
  content = text_area(name, attributes)

  input_wrapper_with_label(name, content, label: label, field: field, options: options, &block)
end