2024-05-17 18:30:25 +00:00
|
|
|
:ruby
|
|
|
|
help_id = "#{id}_help"
|
2024-06-18 19:06:59 +00:00
|
|
|
checkbox_attributes = local_assigns.slice(:id, :type, :name, :value, :required, :checked, :data)
|
2024-05-17 18:30:25 +00:00
|
|
|
checkbox_attributes[:type] ||= 'checkbox'
|
2023-03-28 20:31:35 +00:00
|
|
|
|
2024-05-27 18:15:55 +00:00
|
|
|
.custom-control{ class: "custom-#{checkbox_attributes[:type]}" }
|
2024-05-17 17:59:23 +00:00
|
|
|
%input.custom-control-input{ **checkbox_attributes }
|
2023-03-28 20:31:35 +00:00
|
|
|
%label.custom-control-label{ for: id, aria: { describedby: help_id } }= content
|
2024-05-17 17:59:23 +00:00
|
|
|
- if (block = yield).present?
|
|
|
|
%small.form-text.text-muted{ id: help_id }= block
|