Sha256: 4634b0c27f04ef6c353f4a88fd7df34b4725977b8d3e605f41bd8b1e2f83bb69
Contents?: true
Size: 1.76 KB
Versions: 8
Compression:
Stored size: 1.76 KB
Contents
<% id ||= "textarea-#{SecureRandom.hex(4)}" value ||= nil rows ||= 5 data ||= nil spellcheck ||= "true" label ||= nil hint ||= nil error_message ||= nil error_items ||= nil character_count ||= nil hint_id = "hint-#{SecureRandom.hex(4)}" has_error ||= error_message || error_items&.any? error_id = "error-#{SecureRandom.hex(4)}" css_classes = %w(gem-c-textarea govuk-textarea) css_classes << "js-character-count" if character_count css_classes << "govuk-textarea--error" if has_error form_group_css_classes = %w(govuk-form-group) form_group_css_classes << "govuk-form-group--error" if has_error aria_described_by ||= nil if hint || has_error aria_described_by = [] aria_described_by << hint_id if hint aria_described_by << error_id if has_error 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", { html_for: id }.merge(label.symbolize_keys) %> <% 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_id, text: error_message } %> <% elsif error_items %> <%= render "govuk_publishing_components/components/error_message", { id: error_id, text: raw(error_items.map { |item| item[:text] }.join("<br/>")) } %> <% end %> <%= tag.textarea name: name, value: value, class: css_classes, id: id, rows: rows, data: data, spellcheck: spellcheck, aria: { describedby: aria_described_by } do %><%= value %><% end %> <% end %>
Version data entries
8 entries across 8 versions & 1 rubygems