Sha256: 81ae9dde73349f296d4bd03446e8260f05404da51d685042c3df54f5c8a9edbd
Contents?: true
Size: 1.34 KB
Versions: 10
Compression:
Stored size: 1.34 KB
Contents
require_relative '../radio' module CCS module Components module GovUK class Field < Base class Inputs < Field class Item < Base class Radio < Item # = GOV.UK Field Inputs Radio tag # # This is used to generate an individual radio item using +radio_button_tag+ class Tag < Radio # @param (see CCS::Components::GovUK::Field::Items::Item::Radio#initialize) # # @option (see CCS::Components::GovUK::Field::Items::Item::Radio#initialize) def initialize(attribute:, label:, **options) super(attribute: attribute, label: label, **options) @options[:attributes][:id] ||= "#{sanitize_to_id(@attribute)}_#{sanitize_to_id(@value)}" @label = Label.new(attribute: @options[:attributes][:id], context: @context, **label) end # Generates the HTML for the radio input # # @return [ActiveSupport::SafeBuffer] def render super() do context.radio_button_tag(@attribute, @value, @options[:checked], **@options[:attributes]) end end end end end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems