Class: Primer::OpenProject::DangerConfirmationDialog::ConfirmationCheckBox
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Primer::OpenProject::DangerConfirmationDialog::ConfirmationCheckBox
- Defined in:
- app/components/primer/open_project/danger_confirmation_dialog/confirmation_check_box.rb
Overview
This component is part of ‘Primer::OpenProject::DangerConfirmationDialog` and should not be used as a standalone component.
Constant Summary
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(check_box_id: self.class.generate_id, check_box_name:, **system_arguments) ⇒ ConfirmationCheckBox
constructor
A new instance of ConfirmationCheckBox.
- #render? ⇒ Boolean
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(check_box_id: self.class.generate_id, check_box_name:, **system_arguments) ⇒ ConfirmationCheckBox
Returns a new instance of ConfirmationCheckBox.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/components/primer/open_project/danger_confirmation_dialog/confirmation_check_box.rb', line 13 def initialize(check_box_id: self.class.generate_id, check_box_name:, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( system_arguments[:classes], "DangerConfirmationDialog-confirmationCheckBox" ) @check_box_arguments = {} @check_box_arguments[:id] = check_box_id @check_box_arguments[:name] = check_box_name @check_box_arguments[:data] = { target: "danger-confirmation-dialog-form-helper.checkbox", action: "change:danger-confirmation-dialog-form-helper#toggle" } end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 |
# File 'app/components/primer/open_project/danger_confirmation_dialog/confirmation_check_box.rb', line 30 def call render(Primer::BaseComponent.new(**@system_arguments)) do render(Primer::Alpha::CheckBox.new(**@check_box_arguments.merge(label: trimmed_content))) end end |
#render? ⇒ Boolean
36 37 38 39 40 |
# File 'app/components/primer/open_project/danger_confirmation_dialog/confirmation_check_box.rb', line 36 def render? raise ArgumentError, "ConfirmationCheckBox requires a content block" unless trimmed_content.present? true end |