2022-12-20 17:51:36 +01:00
|
|
|
= content_tag(:div, input_group_opts) do
|
|
|
|
= @form.label @attribute, label_opts do
|
|
|
|
- capture do
|
|
|
|
= label
|
2023-10-02 15:31:32 +02:00
|
|
|
|
|
|
|
- if required?
|
|
|
|
= render EditableChamp::AsteriskMandatoryComponent.new
|
|
|
|
|
2023-05-24 17:44:15 +02:00
|
|
|
- if hint?
|
|
|
|
%span.fr-hint-text= hint
|
2023-10-02 15:31:32 +02:00
|
|
|
|
2023-02-15 11:33:42 +01:00
|
|
|
= @form.public_send(@input_type, @attribute, input_opts)
|
2022-12-15 13:08:20 +01:00
|
|
|
|
|
|
|
- if errors_on_attribute?
|
|
|
|
- if error_messages.size == 1
|
2023-02-15 11:33:42 +01:00
|
|
|
%p.fr-error-text{ id: describedby_id }= error_messages.first
|
2022-12-15 13:08:20 +01:00
|
|
|
- else
|
2023-02-15 11:33:42 +01:00
|
|
|
.fr-error-text{ id: describedby_id }
|
2022-12-16 14:56:46 +01:00
|
|
|
%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
|
2023-02-07 18:06:38 +01:00
|
|
|
%input{ id: show_password_id, "aria-label" => t('.show_password.aria_label'), type: "checkbox" }/
|
|
|
|
%label.fr--password__checkbox.fr-label{ for: show_password_id }= t('.show_password.label')
|
2022-12-20 17:51:36 +01:00
|
|
|
|
|
|
|
- if email?
|
2024-07-29 18:09:15 +02:00
|
|
|
.suspect-email.hidden{ data: { "email-input-target": 'ariaRegion' }, tabindex: '-1' }
|
|
|
|
= render Dsfr::AlertComponent.new(title: t('.email_suggest.mistake'), state: '', extra_class_names: 'fr-alert--info' ) do |c|
|
2024-01-08 11:22:38 +01:00
|
|
|
- c.with_body do
|
2024-07-29 18:09:15 +02:00
|
|
|
%p
|
|
|
|
= t('.email_suggest.wanna_say')
|
|
|
|
%span{ data: { "email-input-target": 'suggestion'} }
|
|
|
|
exemple@gmail.com
|
|
|
|
= "?"
|
2022-12-20 17:51:36 +01:00
|
|
|
%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')
|