Class: Shoelace::Rails::Ui::FormHelper::ShoelaceCheckBox

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#render(&block) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'app/helpers/shoelace/rails/ui/form_helper.rb', line 130

def render(&block)
  options = @options.stringify_keys
  options["value"]   = @checked_value
  options["checked"] = true if input_checked?(options)

  if options["multiple"]
    add_default_name_and_id_for_value(@checked_value, options)
    options.delete("multiple")
  else
    add_default_name_and_id(options)
  end

  if block_given?
    @template_object.('sl-checkbox', '', options, &block)
  else
    @template_object.('sl-checkbox', @method_name.to_s.humanize, options)
  end
end