Sha256: 4891591d145fcf72a5a3b228b43377a59f1c4893b9de13ea034cd0446cc20565
Contents?: true
Size: 1.16 KB
Versions: 16
Compression:
Stored size: 1.16 KB
Contents
module Headmin module Form class CheckboxView < ViewModel include Headmin::Form::Hintable include Headmin::Form::Labelable include Headmin::Form::Validatable include Headmin::Form::Wrappable def checked_value @checked_value || "1" end def unchecked_value @unchecked_value || "0" end def input_options keys = attributes - %i[attribute form label validate wrapper checked_value unchecked_value] options = to_h.slice(*keys) default_input_options.deep_merge(options) end def label_options { class: ["form-check-label"], attribute: attribute, form: form, required: required, text: label } end def wrapper_options default_wrapper_options.deep_merge( { class: %w[form-check mb-3] } ).deep_merge(@wrapper || {}) end private def default_input_options { aria: {describedby: validation_id}, class: ["form-check-input", validation_class], placeholder: placeholder } end end end end
Version data entries
16 entries across 16 versions & 1 rubygems