Class: Effective::FormInputs::Submit

Inherits:
Effective::FormInput show all
Defined in:
app/models/effective/form_inputs/submit.rb

Constant Summary

Constants inherited from Effective::FormInput

Effective::FormInput::BLANK

Instance Attribute Summary

Attributes inherited from Effective::FormInput

#name, #options

Instance Method Summary collapse

Methods inherited from Effective::FormInput

#hint_options, #initialize, #input_group_options, #input_js_options, #to_html

Constructor Details

This class inherits a constructor from Effective::FormInput

Instance Method Details

#build_input(&block) ⇒ Object



5
6
7
# File 'app/models/effective/form_inputs/submit.rb', line 5

def build_input(&block)
  (:button, name, options[:input])
end

#feedback_options ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/models/effective/form_inputs/submit.rb', line 25

def feedback_options
  case layout
  when :inline
    false
  else
    {
      valid: { class: 'valid-feedback', text: 'Looks good! Submitting...' },
      invalid: {
        class: 'invalid-feedback',
        text: 'one or more errors are present. please fix the errors above and try again.'
      }
    }
  end
end

#input_html_options ⇒ Object



17
18
19
# File 'app/models/effective/form_inputs/submit.rb', line 17

def input_html_options
  { class: 'btn btn-primary', type: 'submit', name: 'commit', value: name }
end

#label_options ⇒ Object



21
22
23
# File 'app/models/effective/form_inputs/submit.rb', line 21

def label_options
  false
end

#wrapper_options ⇒ Object



9
10
11
12
13
14
15
# File 'app/models/effective/form_inputs/submit.rb', line 9

def wrapper_options
  if layout == :horizontal
    { class: 'form-group row form-actions'}
  else
    { class: 'form-group form-actions'}
  end
end