2022-12-20 17:51:36 +01:00
|
|
|
|
= content_tag(:div, input_group_opts) do
|
|
|
|
|
= @form.label @attribute, label_opts do
|
|
|
|
|
- capture do
|
|
|
|
|
= label
|
|
|
|
|
- if @required
|
|
|
|
|
%span.mandatory *
|
|
|
|
|
- if hint?
|
|
|
|
|
%span.fr-hint-text= hint
|
2022-12-15 13:08:20 +01:00
|
|
|
|
|
|
|
|
|
= @form.send(@input_type, @attribute, input_opts)
|
|
|
|
|
|
|
|
|
|
- if errors_on_attribute?
|
|
|
|
|
- if error_messages.size == 1
|
|
|
|
|
%p.fr-error-text{ id: error_message_id }= error_messages.first
|
|
|
|
|
- else
|
2022-12-16 14:56:46 +01:00
|
|
|
|
.fr-error-text{ id: error_message_id }
|
|
|
|
|
%ul.list-style-type-none.fr-pl-0
|
2022-12-15 13:08:20 +01:00
|
|
|
|
- error_messages.map do |error_message|
|
|
|
|
|
%li= error_message
|
|
|
|
|
|
2022-12-20 17:51:36 +01:00
|
|
|
|
- elsif describedby.present?
|
|
|
|
|
= describedby
|
|
|
|
|
|
|
|
|
|
- if password?
|
|
|
|
|
.fr-password__checkbox.fr-checkbox-group.fr-checkbox-group--sm
|
|
|
|
|
%input#show_password{ "aria-label" => t('.show_password.aria_label'), type: "checkbox" }/
|
|
|
|
|
%label.fr--password__checkbox.fr-label{ for: "show_password" }= t('.show_password.label')
|
|
|
|
|
|
|
|
|
|
- if email?
|
|
|
|
|
.suspect-email.hidden{ data: { "email-input-target": 'ariaRegion'}, aria: { live: 'off' } }
|
|
|
|
|
= render Dsfr::AlertComponent.new(title: t('.email_suggest.wanna_say'), state: :info, heading_level: :div) do |c|
|
|
|
|
|
- c.body do
|
|
|
|
|
%p{ data: { "email-input-target": 'suggestion'} } exemple@gmail.com ?
|
|
|
|
|
%p
|
|
|
|
|
= button_tag type: 'button', class: 'fr-btn fr-btn--sm fr-mr-3w', data: { action: 'click->email-input#accept'} do
|
|
|
|
|
= t('utils.yes')
|
|
|
|
|
= button_tag type: 'button', class: 'fr-btn fr-btn--sm', data: { action: 'click->email-input#discard'} do
|
|
|
|
|
= t('utils.no')
|