Class: Shoelace::Components::SlCheckbox
- Inherits:
-
ActionView::Helpers::Tags::CheckBox
- Object
- ActionView::Helpers::Tags::CheckBox
- Shoelace::Components::SlCheckbox
- Includes:
- ErrorWrappable
- Defined in:
- app/helpers/shoelace/components/sl_checkbox.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods included from ErrorWrappable
Instance Method Details
#render(&block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/shoelace/components/sl_checkbox.rb', line 10 def render(&block) = @options.stringify_keys ["value"] = @checked_value ["checked"] = true if input_checked?() ["invalid"] = ["data-invalid"] = "" if object_has_errors? label = .delete("label") if ["multiple"] add_default_name_and_id_for_value(@checked_value, ) .delete("multiple") else add_default_name_and_id() end include_hidden = .delete("include_hidden") { true } sl_checkbox_tag = if block_given? @template_object.content_tag('sl-checkbox', '', , &block) else @template_object.content_tag('sl-checkbox', label, ) end if include_hidden hidden_field_for_checkbox() + sl_checkbox_tag else sl_checkbox_tag end end |