Changements sur le caractère obligatoire / facultatif et l'asterisque interface usager et page de connexion
This commit is contained in:
parent
0d1754d715
commit
804f89f444
18 changed files with 42 additions and 24 deletions
|
@ -17,6 +17,7 @@
|
|||
color: $dark-grey;
|
||||
}
|
||||
|
||||
|
||||
.mandatory {
|
||||
color: $dark-red;
|
||||
}
|
||||
|
|
|
@ -173,4 +173,8 @@
|
|||
&.move-handle {
|
||||
background-image: image-url("icons/move-handle.svg");
|
||||
}
|
||||
|
||||
&.mandatory {
|
||||
width: 10px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
= @form.label @attribute, label_opts do
|
||||
- capture do
|
||||
= label
|
||||
- if @required
|
||||
%span.mandatory *
|
||||
- if hint?
|
||||
%span.fr-hint-text= hint
|
||||
|
||||
= @form.public_send(@input_type, @attribute, input_opts)
|
||||
|
||||
- if errors_on_attribute?
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
class EditableChamp::AsteriskMandatoryComponent < ApplicationComponent
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
en:
|
||||
required: required
|
|
@ -0,0 +1,2 @@
|
|||
fr:
|
||||
required: obligatoire
|
|
@ -0,0 +1,3 @@
|
|||
%svg.icon.mandatory{ xmlns: "http://www.w3.org/2000/svg", role: "img", 'aria-label': t('.required'), width: 10, height: 10, viewBox: "0 0 1200 1200", "xml:space" => "preserve" }
|
||||
%desc= t('.required')
|
||||
%path{ d: "M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z" }
|
|
@ -3,3 +3,4 @@ en:
|
|||
changes_to_save: "modifications to submit"
|
||||
modified_at: "modified on %{datetime}"
|
||||
check_content_rebased: The type of this field or its description has been modified by the administration. Check its content.
|
||||
optional_champ: (optional)
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
fr:
|
||||
changes_to_save: "modification à déposer"
|
||||
modified_at: "modifié le %{datetime}"
|
||||
check_content_rebased: Le type de ce champ ou sa description ont été modifiés par l’administration. Vérifier son contenu.
|
||||
check_content_rebased: Le type de ce champ ou sa description ont été modifiés par l'administration. Vérifier son contenu.
|
||||
optional_champ: (facultatif)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#{@champ.libelle}
|
||||
- if @champ.mandatory?
|
||||
%span.mandatory *
|
||||
= @champ.libelle
|
||||
- if @champ.mandatory? && @champ.type_champ != "checkbox"
|
||||
= render EditableChamp::AsteriskMandatoryComponent.new
|
||||
- elsif !@champ.mandatory?
|
||||
= "#{t('.optional_champ')}"
|
||||
|
||||
- if @champ.forked_with_changes?
|
||||
%span.updated-at.highlighted
|
||||
|
@ -9,6 +11,7 @@
|
|||
%span.updated-at{ class: highlight_if_unseen_class }
|
||||
= t('.modified_at', datetime: try_format_datetime(@champ.updated_at))
|
||||
|
||||
|
||||
- if @champ.rebased_at.present? && @champ.rebased_at > (@seen_at || @champ.updated_at) && current_user.owns_or_invite?(@champ.dossier)
|
||||
%span.updated-at.highlighted
|
||||
= t('.check_content_rebased')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
= @form.check_box :value,
|
||||
{ required: @champ.required?, id: @champ.input_id, checked: @champ.true?, aria: { describedby: @champ.describedby_id } },
|
||||
{ required: @champ.required?, id: @champ.input_id, checked: @champ.true?, aria: { describedby: @champ.describedby_id }, class: class_names('required' => @champ.required?)},
|
||||
'true',
|
||||
'false'
|
||||
|
|
|
@ -28,8 +28,8 @@ class SimpleFormatComponent < ApplicationComponent
|
|||
@allow_a = allow_a
|
||||
|
||||
@text = (text || "").gsub(/\R/, "\n\n") # force double \n otherwise a single one won't split paragraph
|
||||
.split("\n\n") #
|
||||
.map(&:lstrip) # this block prevent redcarpet to consider " text" as block code by lstriping
|
||||
.split("\n\n")
|
||||
.map(&:lstrip) # this block prevent redcarpet to consider " text" as block code by lstriping
|
||||
.join("\n\n")
|
||||
.gsub(EMAIL_IN_TEXT_REGEX) { _1.gsub('_', '\\_') } # Workaround for redcarpet bug on autolink email having _. Cf tests
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
.recommandations
|
||||
%h2
|
||||
= t('.intro_html')
|
||||
%p.mandatory-explanation= t('asterisk_html', scope: [:utils])
|
||||
%p.mandatory-explanation= t('mandatory_champs', scope: [:utils])
|
||||
|
||||
- if !user_signed_in?
|
||||
.fr-input-group
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
%h2.fr-h6= I18n.t('views.registrations.new.subtitle')
|
||||
|
||||
.fr-fieldset__element
|
||||
%p.fr-text--sm= t('utils.asterisk_html')
|
||||
%p.fr-text--sm= t('utils.mandatory_champs')
|
||||
|
||||
.fr-fieldset__element= render Dsfr::InputComponent.new(form: f, attribute: :email, input_type: :email_field, opts: { autocomplete: 'email', autofocus: true })
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
%h2.fr-h6= I18n.t('views.users.sessions.new.subtitle')
|
||||
|
||||
.fr-fieldset__element
|
||||
%p.fr-text--sm= t('utils.asterisk_html')
|
||||
%p.fr-text--sm= t('utils.mandatory_champs')
|
||||
|
||||
.fr-fieldset__element= render Dsfr::InputComponent.new(form: f, attribute: :email, input_type: :email_field, opts: { autocomplete: 'email', autofocus: true })
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ en:
|
|||
deconnexion: "Log out"
|
||||
pj: "Attachments"
|
||||
asterisk_html: Fields marked by an asterisk ( <span class = mandatory>*</span> ) are mandatory.
|
||||
mandatory_champs: All fields are mandatory.
|
||||
file_number: File number
|
||||
subject: Subject
|
||||
message: Message
|
||||
|
|
|
@ -40,7 +40,8 @@ fr:
|
|||
i_dont_know: Je ne sais pas
|
||||
deconnexion: "Déconnexion"
|
||||
pj: "Pièces jointes"
|
||||
asterisk_html: Les champs suivis d’un astérisque ( <span class = mandatory> * </span> ) sont obligatoires.
|
||||
asterisk_html: Les champs suivis d’un astérisque ( * ) sont obligatoires.
|
||||
mandatory_champs: Tous les champs sont obligatoires.
|
||||
file_number: Numéro de dossier
|
||||
subject: Sujet
|
||||
message: Message
|
||||
|
|
|
@ -12,9 +12,9 @@ describe 'The user' do
|
|||
fill_individual
|
||||
|
||||
# fill data
|
||||
fill_in('text *', with: 'super texte')
|
||||
fill_in('text', with: 'super texte', match: :first)
|
||||
fill_in('textarea', with: 'super textarea')
|
||||
fill_in('date *', with: '12-12-2012')
|
||||
fill_in('date', with: '12-12-2012', match: :first)
|
||||
fill_in('datetime', with: Time.zone.parse('2023-01-06T07:05'))
|
||||
find("input[type=datetime-local]").send_keys(:arrow_up).send_keys(:arrow_down) # triggers onChange
|
||||
fill_in('number', with: '42')
|
||||
|
@ -329,7 +329,7 @@ describe 'The user' do
|
|||
|
||||
fill_individual
|
||||
|
||||
fill_in('age', with: 10)
|
||||
fill_in('age (facultatif)', with: 10)
|
||||
click_on 'Déposer le dossier'
|
||||
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
||||
end
|
||||
|
@ -400,9 +400,9 @@ describe 'The user' do
|
|||
|
||||
fill_individual
|
||||
|
||||
fill_in('age', with: '18')
|
||||
expect(page).to have_css('label', text: 'nom *', visible: :visible)
|
||||
|
||||
fill_in('age (facultatif)', with: '18')
|
||||
expect(page).to have_css('label', text: 'nom', visible: :visible)
|
||||
expect(page).to have_css('.icon.mandatory')
|
||||
click_on 'Déposer le dossier'
|
||||
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
|
||||
end
|
||||
|
@ -437,7 +437,7 @@ describe 'The user' do
|
|||
expect(page).to have_no_css('legend h2', text: 'info voiture', visible: true)
|
||||
expect(page).to have_no_css('label', text: 'tonnage', visible: true)
|
||||
|
||||
fill_in('age', with: '18')
|
||||
fill_in('age (facultatif)', with: '18')
|
||||
expect(page).to have_css('label', text: 'permis de conduire', visible: true)
|
||||
expect(page).to have_css('legend h2', text: 'info voiture', visible: true)
|
||||
expect(page).to have_no_css('label', text: 'tonnage', visible: true)
|
||||
|
@ -450,10 +450,10 @@ describe 'The user' do
|
|||
expect(page).to have_css('label', text: 'parking', visible: true)
|
||||
|
||||
# try to fill with invalid data
|
||||
fill_in('tonnage', with: 'a')
|
||||
fill_in('tonnage (facultatif)', with: 'a')
|
||||
expect(page).to have_no_css('label', text: 'parking', visible: true)
|
||||
|
||||
fill_in('age', with: '2')
|
||||
fill_in('age (facultatif)', with: '2')
|
||||
expect(page).to have_no_css('label', text: 'permis de conduire', visible: true)
|
||||
expect(page).to have_no_css('label', text: 'tonnage', visible: true)
|
||||
|
||||
|
@ -465,7 +465,7 @@ describe 'The user' do
|
|||
expect(page).to have_no_css('label', text: 'permis de conduire', visible: true)
|
||||
expect(page).to have_no_css('label', text: 'tonnage', visible: true)
|
||||
|
||||
fill_in('age', with: '18')
|
||||
fill_in('age (facultatif)', with: '18')
|
||||
wait_for_autosave(false)
|
||||
|
||||
# the champ keeps their previous value so they are all displayed
|
||||
|
|
Loading…
Reference in a new issue