Class: CCS::Components::GovUK::Field::Inputs::DateInput
- Inherits:
-
CCS::Components::GovUK::Field::Inputs
- Object
- Base
- CCS::Components::GovUK::Field
- CCS::Components::GovUK::Field::Inputs
- CCS::Components::GovUK::Field::Inputs::DateInput
- Defined in:
- lib/ccs/components/govuk/field/inputs/date_input.rb,
lib/ccs/components/govuk/field/inputs/date_input/item.rb
Overview
GOV.UK Date Input
This is used for generating the date input component from the GDS - Components - Date Input
Defined Under Namespace
Classes: Item
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the date input
{ class: 'govuk-date-input' }.freeze
Instance Method Summary collapse
-
#initialize(attribute:, date_items: nil, **options) ⇒ DateInput
constructor
A new instance of DateInput.
Methods inherited from CCS::Components::GovUK::Field::Inputs
Methods inherited from CCS::Components::GovUK::Field
Constructor Details
#initialize(attribute:, date_items: nil, **options) ⇒ DateInput
Returns a new instance of DateInput.
21 22 23 24 25 26 27 28 29 |
# File 'lib/ccs/components/govuk/field/inputs/date_input.rb', line 21 def initialize(attribute:, date_items: nil, **) ([:fieldset][:attributes] ||= {})[:role] = 'group' if [:fieldset] super(attribute: attribute, **) date_items = default_date_items if date_items.blank? @input_items = date_items.map { |date_input_item| Item.new(attribute: attribute, error_message: @error_message, model: @options[:model], form: @options[:form], context: @context, **date_input_item) } end |