Sha256: 63f1033e9283ed7867921f15a44699491a5d05513d5b82cdc399ee334221bf52
Contents?: true
Size: 1.51 KB
Versions: 13
Compression:
Stored size: 1.51 KB
Contents
<% id ||= "input-#{SecureRandom.hex(4)}" value ||= nil type ||= "text" describedby ||= false data ||= nil label ||= nil hint ||= nil error_message ||= nil hint_id = "hint-#{SecureRandom.hex(4)}" if hint error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message css_classes = %w(gem-c-input govuk-input) css_classes << "govuk-input--error" if error_message form_group_css_classes = %w(govuk-form-group) form_group_css_classes << "govuk-form-group--error" if error_message aria_described_by ||= nil if hint || error_message || describedby aria_described_by = [] aria_described_by << hint_id if hint aria_described_by << error_message_id if error_message aria_described_by << describedby if describedby aria_described_by = aria_described_by.join(" ") end %> <%= content_tag :div, class: form_group_css_classes do %> <% if label %> <%= render "govuk_publishing_components/components/label", { text: label[:text], html_for: id } %> <% end %> <% if hint %> <%= render "govuk_publishing_components/components/hint", { id: hint_id, text: hint } %> <% end %> <% if error_message %> <%= render "govuk_publishing_components/components/error_message", { id: error_message_id, text: error_message } %> <% end %> <%= text_field_tag name, value, { class: css_classes, id: id, type: type, data: data, aria: { describedby: aria_described_by } } %> <% end %>
Version data entries
13 entries across 13 versions & 1 rubygems