Class: Shoelace::Rails::Ui::FormHelper::ShoelaceFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- Shoelace::Rails::Ui::FormHelper::ShoelaceFormBuilder
- Defined in:
- app/helpers/shoelace/rails/ui/form_helper.rb
Overview
:nodoc:
Instance Method Summary collapse
- #check_box(method, options = {}, checked_value = "1", unchecked_value = "0", &block) ⇒ Object
- #collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object
- #collection_select(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object
- #color_field(method, **options) ⇒ Object (also: #color_picker)
- #range_field(method, **options) ⇒ Object (also: #range)
- #select(method, choices = nil, options = {}, html_options = {}, &block) ⇒ Object
- #submit(value = nil, options = {}) ⇒ Object
- #switch_field(method, **options, &block) ⇒ Object (also: #switch)
- #text_area(method, **options) ⇒ Object
Instance Method Details
#check_box(method, options = {}, checked_value = "1", unchecked_value = "0", &block) ⇒ Object
233 234 235 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 233 def check_box(method, = {}, checked_value = "1", unchecked_value = "0", &block) ShoelaceCheckBox.new(object_name, method, @template, checked_value, unchecked_value, .merge(object: @object)).render(&block) end |
#collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object
245 246 247 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 245 def (method, collection, value_method, text_method, = {}, = {}, &block) ShoelaceCollectionRadioButtons.new(object_name, method, @template, collection, value_method, text_method, .with_defaults(object: @object), ).render(&block) end |
#collection_select(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object
241 242 243 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 241 def collection_select(method, collection, value_method, text_method, = {}, = {}, &block) ShoelaceCollectionSelect.new(object_name, method, @template, collection, value_method, text_method, .with_defaults(object: @object), , &block).render end |
#color_field(method, **options) ⇒ Object Also known as: color_picker
214 215 216 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 214 def color_field(method, **) ShoelaceColorPicker.new(object_name, method, @template, .with_defaults(object: @object)).render end |
#range_field(method, **options) ⇒ Object Also known as: range
219 220 221 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 219 def range_field(method, **) ShoelaceRange.new(object_name, method, @template, .with_defaults(object: @object)).render end |
#select(method, choices = nil, options = {}, html_options = {}, &block) ⇒ Object
237 238 239 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 237 def select(method, choices = nil, = {}, = {}, &block) ShoelaceSelect.new(object_name, method, @template, choices, .with_defaults(object: @object), , &block).render end |
#submit(value = nil, options = {}) ⇒ Object
249 250 251 252 253 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 249 def submit(value = nil, = {}) value, = nil, value if value.is_a?(Hash) @template.sl_submit_tag(value || submit_default_value, **) end |
#switch_field(method, **options, &block) ⇒ Object Also known as: switch
224 225 226 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 224 def switch_field(method, **, &block) ShoelaceSwitch.new(object_name, method, @template, .with_defaults(object: @object)).render(&block) end |
#text_area(method, **options) ⇒ Object
229 230 231 |
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 229 def text_area(method, **) ShoelaceTextArea.new(object_name, method, @template, .with_defaults(object: @object, resize: 'auto')).render end |