Sha256: 7697eddb14d72d2beaf507d6ad1451965f5bbc5208ba4fdb939e153c15ce5018
Contents?: true
Size: 1.92 KB
Versions: 28
Compression:
Stored size: 1.92 KB
Contents
<% id ||= "textarea-#{SecureRandom.hex(4)}" value ||= nil rows ||= 5 data ||= nil spellcheck ||= "true" label ||= nil hint ||= nil local_assigns[:margin_bottom] ||= 6 local_assigns[:margin_bottom] = 6 if local_assigns[:margin_bottom] > 9 error_message ||= nil error_items ||= [] character_count ||= nil maxlength ||= nil hint_id = "hint-#{SecureRandom.hex(4)}" has_error ||= error_message || error_items.any? error_id = "error-#{SecureRandom.hex(4)}" shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) css_classes = %w(govuk-textarea) css_classes << "js-character-count" if character_count css_classes << "govuk-textarea--error" if has_error form_group_css_classes = %w(gem-c-textarea govuk-form-group) form_group_css_classes << "govuk-form-group--error" if has_error form_group_css_classes << (shared_helper.get_margin_bottom) 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 has_error %> <%= render "govuk_publishing_components/components/error_message", { id: error_id, text: error_message, items: error_items, } %> <% end %> <%= tag.textarea name: name, class: css_classes, id: id, rows: rows, maxlength: maxlength, data: data, spellcheck: spellcheck, aria: { describedby: aria_described_by } do %><%= value %><% end %> <% if block_given? %> <%= yield %> <% end %> <% end %>
Version data entries
28 entries across 28 versions & 1 rubygems