Sha256: 745774fa3113a3f87b67dcba0f77ff3554e30f9a1f8898d7b24a26c2b1f9da41
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
<% # Infer name and id_prefix from attribute key local_assigns[:id] ||= get_attribute_id_prefix(form, key) errors = form.object.errors date_errors = errors.full_messages_for(key.to_sym) day_errors = errors.full_messages_for("#{key}_day".to_sym) month_errors = errors.full_messages_for("#{key}_month".to_sym) year_errors = errors.full_messages_for("#{key}_year".to_sym) local_assigns[:items] = [ { label: "day", classes: "govuk-input--width-2 #{'govuk-input--error' if day_errors.any? || date_errors.any?}", value: form.object.send(:get_day, key), name: "#{get_attribute_name(form, key)}[day]" }, { label: "month", classes: "govuk-input--width-2 #{'govuk-input--error' if month_errors.any? || date_errors.any?}", value: form.object.send(:get_month, key), name: "#{get_attribute_name(form, key)}[month]" }, { label: "year", classes: "govuk-input--width-4 #{'govuk-input--error' if year_errors.any? || date_errors.any?}", value: form.object.send(:get_year, key), name: "#{get_attribute_name(form, key)}[year]" } ] error_text = errors.full_messages_for(key).first.presence local_assigns[:errorMessage] ||= { text: error_text } if error_text %> <%= render "components/govuk_date_input", **local_assigns %>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
govuk-design-system-rails-0.10.1 | app/views/form_components/_govuk_date_input.html.erb |