blob: 4ece904fb85605b167aeb716f0f17a79418a890d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# frozen_string_literal: true
module Pajamas
module Concerns
module CheckboxRadioLabelWithHelpText
def render_label_with_help_text
form.label(method, formatted_label_options) { label_entry }
end
private
def label_entry
if help_text_content
content_tag(:span, label_content) +
content_tag(:p, help_text_content, class: 'help-text', data: { testid: 'pajamas-component-help-text' })
else
content_tag(:span, label_content)
end
end
def formatted_label_options
format_options(
options: label_options,
css_classes: ['custom-control-label'],
additional_options: { value: value }
)
end
end
end
end
|