Class: Primer::Forms::Dsl::CheckBoxGroupInput

Inherits:
Input
  • Object
show all
Defined in:
lib/primer/forms/dsl/check_box_group_input.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Input

Input::DEFAULT_SIZE, Input::SIZE_MAPPINGS, Input::SIZE_OPTIONS, Input::SPACE_DELIMITED_ARIA_ATTRIBUTES

Instance Attribute Summary collapse

Attributes inherited from Input

#builder, #caption, #form, #ids, #input_arguments, #label_arguments, #validation_message

Instance Method Summary collapse

Methods inherited from Input

#add_input_aria, #add_input_classes, #add_input_data, #add_label_classes, #autofocus!, #caption?, #caption_id, #caption_template?, #disabled?, #focusable?, #full_width?, #hidden?, #input?, #invalid?, #merge_input_arguments!, #remove_input_data, #render_caption_template, #required?, #size, #valid?, #validation_id, #validation_messages

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(label: nil, **system_arguments) {|_self| ... } ⇒ CheckBoxGroupInput

Returns a new instance of CheckBoxGroupInput.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
15
16
17
18
19
# File 'lib/primer/forms/dsl/check_box_group_input.rb', line 10

def initialize(label: nil, **system_arguments)
  @label = label
  @check_boxes = []

  super(**system_arguments)

  add_label_classes("FormControl-label", "mb-2")

  yield(self) if block_given?
end

Instance Attribute Details

#check_boxesObject (readonly)

Returns the value of attribute check_boxes.



8
9
10
# File 'lib/primer/forms/dsl/check_box_group_input.rb', line 8

def check_boxes
  @check_boxes
end

#labelObject (readonly)

Returns the value of attribute label.



8
9
10
# File 'lib/primer/forms/dsl/check_box_group_input.rb', line 8

def label
  @label
end

Instance Method Details

#check_box(**system_arguments) ⇒ Object



33
34
35
36
37
# File 'lib/primer/forms/dsl/check_box_group_input.rb', line 33

def check_box(**system_arguments)
  @check_boxes << CheckBoxInput.new(
    builder: @builder, form: @form, **system_arguments
  )
end

#nameObject



25
26
27
# File 'lib/primer/forms/dsl/check_box_group_input.rb', line 25

def name
  nil
end

#to_componentObject



21
22
23
# File 'lib/primer/forms/dsl/check_box_group_input.rb', line 21

def to_component
  CheckBoxGroup.new(input: self)
end

#typeObject



29
30
31
# File 'lib/primer/forms/dsl/check_box_group_input.rb', line 29

def type
  :check_box_group
end