Sha256: 1f39c40d805644bc3ecd0f7e0f1a6812ae12d0720b12d0c4fdb3e1008c469842
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
module GOVUKDesignSystemFormBuilder module Elements module Radios class CollectionRadio < Base def initialize(builder, object_name, attribute_name, item, value_method, text_method, hint_method) super(builder, object_name, attribute_name) @item = item @value = item.send(value_method) @text = item.send(text_method) @hint_text = item.send(hint_method) if hint_method.present? end def html @builder.content_tag('div', class: 'govuk-radios__item') do @builder.safe_join( [ @builder.radio_button( @attribute_name, @value, id: attribute_descriptor, aria: { describedby: hint_id }, class: %w(govuk-radios__input) ), Elements::Label.new(@builder, @object_name, @attribute_name, text: @text, value: @value).html, Elements::Hint.new(@builder, @object_name, @attribute_name, @hint_text, @value, radio: true).html, ].compact ) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems