Class: AppFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- AppFormBuilder
- Defined in:
- app/helpers/app_form_builder.rb,
lib/generators/quicksilver_ui/form/templates/app_form_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #checkbox(method, options = {}) ⇒ Object
- #date_field(method, options = {}) ⇒ Object
- #email_field(method, options = {}) ⇒ Object
- #error(method, text = nil, options = {}, &block) ⇒ Object
- #file_field(method, options = {}) ⇒ Object
- #group(method, options = {}) ⇒ Object
- #hint(method, text = nil, options = {}, &block) ⇒ Object
- #label(method, text = nil, options = {}, &block) ⇒ Object
- #password_field(method, options = {}) ⇒ Object
- #phone_field(method, options = {}) ⇒ Object
- #radio_button(method, tag_value, options = {}) ⇒ Object
- #search_field(method, options = {}) ⇒ Object
- #select(method, choices = nil, options = {}, html_options = {}) ⇒ Object
- #submit(value = nil, options = {}) ⇒ Object
- #text_field(method, options = {}) ⇒ Object
- #textarea(method, options = {}) ⇒ Object (also: #text_area)
- #toggle(method, options = {}) ⇒ Object
Class Method Details
.with_blank_error_proc(&block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/app_form_builder.rb', line 4 def self.with_blank_error_proc(&block) old_error_proc = ActionView::Base.field_error_proc begin ActionView::Base.field_error_proc = proc do |tag, instance| tag end block.call ensure ActionView::Base.field_error_proc = old_error_proc end end |
Instance Method Details
#checkbox(method, options = {}) ⇒ Object
83 84 85 |
# File 'app/helpers/app_form_builder.rb', line 83 def checkbox(method, = {}) render Form::Checkbox.new(form: self, method:, **) end |
#date_field(method, options = {}) ⇒ Object
24 25 26 |
# File 'app/helpers/app_form_builder.rb', line 24 def date_field(method, = {}) render Form::DateField.new(form: self, method:, **) end |
#email_field(method, options = {}) ⇒ Object
28 29 30 |
# File 'app/helpers/app_form_builder.rb', line 28 def email_field(method, = {}) render Form::EmailField.new(form: self, method:, **) end |
#error(method, text = nil, options = {}, &block) ⇒ Object
75 76 77 |
# File 'app/helpers/app_form_builder.rb', line 75 def error(method, text = nil, = {}, &block) render Form::Error.new(form: self, method:, text:, **) end |
#file_field(method, options = {}) ⇒ Object
36 37 38 |
# File 'app/helpers/app_form_builder.rb', line 36 def file_field(method, = {}) render Form::FileField.new(form: self, method:, **) end |
#group(method, options = {}) ⇒ Object
16 17 18 |
# File 'app/helpers/app_form_builder.rb', line 16 def group(method, = {}) render Form::Group.new(form: self, method:, type: [:type] || :text, **.except(:type)) end |
#hint(method, text = nil, options = {}, &block) ⇒ Object
71 72 73 |
# File 'app/helpers/app_form_builder.rb', line 71 def hint(method, text = nil, = {}, &block) render Form::Hint.new(form: self, method:, text:, **) end |
#label(method, text = nil, options = {}, &block) ⇒ Object
67 68 69 |
# File 'app/helpers/app_form_builder.rb', line 67 def label(method, text = nil, = {}, &block) render Form::Label.new(form: self, method:, text:, **) end |
#password_field(method, options = {}) ⇒ Object
40 41 42 |
# File 'app/helpers/app_form_builder.rb', line 40 def password_field(method, = {}) render Form::PasswordField.new(form: self, method:, **) end |
#phone_field(method, options = {}) ⇒ Object
32 33 34 |
# File 'app/helpers/app_form_builder.rb', line 32 def phone_field(method, = {}) render Form::PhoneField.new(form: self, method:, **) end |
#radio_button(method, tag_value, options = {}) ⇒ Object
91 92 93 |
# File 'app/helpers/app_form_builder.rb', line 91 def (method, tag_value, = {}) render Form::RadioButton.new(form: self, tag_value:, method:, **) end |
#search_field(method, options = {}) ⇒ Object
44 45 46 |
# File 'app/helpers/app_form_builder.rb', line 44 def search_field(method, = {}) render Form::SearchField.new(form: self, method:, **) end |
#select(method, choices = nil, options = {}, html_options = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/app_form_builder.rb', line 48 def select(method, choices = nil, = {}, = {}) render Form::Select.new( form: self, method:, choices:, selected: [:selected], include_blank: .fetch(:include_blank, true), prompt: [:prompt], disabled: [:disabled], include_hidden: .fetch(:include_hidden, true), html_options: ) end |
#submit(value = nil, options = {}) ⇒ Object
79 80 81 |
# File 'app/helpers/app_form_builder.rb', line 79 def submit(value = nil, = {}) super(value, .with_defaults(class: "ui-button ui-button-primary")) end |
#text_field(method, options = {}) ⇒ Object
20 21 22 |
# File 'app/helpers/app_form_builder.rb', line 20 def text_field(method, = {}) render Form::TextField.new(form: self, method:, **) end |
#textarea(method, options = {}) ⇒ Object Also known as: text_area
62 63 64 |
# File 'app/helpers/app_form_builder.rb', line 62 def textarea(method, = {}) render Form::Textarea.new(form: self, method:, **) end |
#toggle(method, options = {}) ⇒ Object
87 88 89 |
# File 'app/helpers/app_form_builder.rb', line 87 def toggle(method, = {}) render Form::Toggle.new(form: self, method:, **) end |