Class: Shoelace::Rails::Ui::FormHelper::ShoelaceFormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
app/helpers/shoelace/rails/ui/form_helper.rb

Overview

:nodoc:

Instance Method Summary collapse

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, options = {}, checked_value = "1", unchecked_value = "0", &block)
  ShoelaceCheckBox.new(object_name, method, @template, checked_value, unchecked_value, options.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 collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
  ShoelaceCollectionRadioButtons.new(object_name, method, @template, collection, value_method, text_method, options.with_defaults(object: @object), html_options).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, options = {}, html_options = {}, &block)
  ShoelaceCollectionSelect.new(object_name, method, @template, collection, value_method, text_method, options.with_defaults(object: @object), html_options, &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, **options)
  ShoelaceColorPicker.new(object_name, method, @template, options.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, **options)
  ShoelaceRange.new(object_name, method, @template, options.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, options = {}, html_options = {}, &block)
  ShoelaceSelect.new(object_name, method, @template, choices, options.with_defaults(object: @object), html_options, &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, options = {})
  value, options = nil, value if value.is_a?(Hash)

  @template.sl_submit_tag(value || submit_default_value, **options)
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, **options, &block)
  ShoelaceSwitch.new(object_name, method, @template, options.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, **options)
  ShoelaceTextArea.new(object_name, method, @template, options.with_defaults(object: @object, resize: 'auto')).render
end