Class: Shoelace::Components::SlSwitch
- Inherits:
-
ActionView::Helpers::Tags::NumberField
- Object
- ActionView::Helpers::Tags::NumberField
- Shoelace::Components::SlSwitch
- Includes:
- ErrorWrappable
- Defined in:
- app/helpers/shoelace/components/sl_switch.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods included from ErrorWrappable
Instance Method Details
#field_type ⇒ Object
10 |
# File 'app/helpers/shoelace/components/sl_switch.rb', line 10 def field_type; nil; end |
#render(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/shoelace/components/sl_switch.rb', line 12 def render(&block) = @options.stringify_keys ["value"] = .fetch("value") { value_before_type_cast } add_default_name_and_id() label = .delete('label').presence ["invalid"] = ["data-invalid"] = "" if object_has_errors? content_tag('sl-switch', label, , &block) end |