diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /app/components/pajamas/checkbox_tag_component.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'app/components/pajamas/checkbox_tag_component.rb')
-rw-r--r-- | app/components/pajamas/checkbox_tag_component.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/app/components/pajamas/checkbox_tag_component.rb b/app/components/pajamas/checkbox_tag_component.rb new file mode 100644 index 00000000000..45e88588059 --- /dev/null +++ b/app/components/pajamas/checkbox_tag_component.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +# Renders a Pajamas compliant checkbox element +module Pajamas + class CheckboxTagComponent < Pajamas::Component + include Pajamas::Concerns::CheckboxRadioLabelWithHelpText + include Pajamas::Concerns::CheckboxRadioOptions + + renders_one :label + renders_one :help_text + + def initialize( + name:, + label_options: {}, + checkbox_options: {}, + value: '1', + checked: false + ) + @name = name + @label_options = label_options + @input_options = checkbox_options + @value = value + @checked = checked + end + + private + + attr_reader( + :name, + :label_options, + :input_options, + :value, + :checked + ) + + def label_content + label + end + + def help_text_content + help_text + end + end +end |