Class: EndView::Form::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/end_view/form/builder.rb

Direct Known Subclasses

RecordBuilder

Instance Method Summary collapse

Instance Method Details

#auth_token_opts(opts = {}) ⇒ Object



16
17
18
19
20
# File 'lib/end_view/form/builder.rb', line 16

def auth_token_opts(opts = {})
  { name: 'auth_token',
    type: 'hidden',
    value: auth_token }.merge(opts)
end

#form_method_opts(opts = {}) ⇒ Object



22
23
24
# File 'lib/end_view/form/builder.rb', line 22

def form_method_opts(opts = {})
  { name: '_method', type: 'hidden', value: form_method }.merge(opts)
end

#form_opts(opts = {}) ⇒ Object



12
13
14
# File 'lib/end_view/form/builder.rb', line 12

def form_opts(opts = {})
  { action: form_url, method: 'post' }.merge(opts)
end

#input_opts(attribute, opts = {}) ⇒ Object



30
31
32
33
34
# File 'lib/end_view/form/builder.rb', line 30

def input_opts(attribute, opts = {})
  { id: attribute_id(attribute),
    name: attribute_name(attribute),
    type: 'text' }.merge(find_default(attribute)).merge(opts)
end

#label_opts(attribute, opts = {}) ⇒ Object



26
27
28
# File 'lib/end_view/form/builder.rb', line 26

def label_opts(attribute, opts = {})
  { for: attribute_id(attribute) }.merge(opts)
end