Class: CCS::Components::GovUK::Field::Input::TextInput::Fix
- Defined in:
- lib/ccs/components/govuk/field/input/text_input/fix.rb
Overview
GOV.UK Text Input prefix/suffix
This is used to generate the prefix/suffix HTML for a text input
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(text:, fix:, **options) ⇒ Fix
constructor
A new instance of Fix.
-
#render { ... } ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Text Input prefix/suffix.
Constructor Details
#initialize(text:, fix:, **options) ⇒ Fix
Returns a new instance of Fix.
31 32 33 34 35 36 37 38 |
# File 'lib/ccs/components/govuk/field/input/text_input/fix.rb', line 31 def initialize(text:, fix:, **) super(**) @options[:attributes][:class] = "govuk-input__#{fix}fix #{@options[:attributes][:class]}".rstrip (@options[:attributes][:aria] ||= {})[:hidden] = true @text = text end |
Instance Method Details
#render { ... } ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Text Input prefix/suffix
46 47 48 |
# File 'lib/ccs/components/govuk/field/input/text_input/fix.rb', line 46 def render tag.div(text, **[:attributes]) end |