replace html labels with h2 elements

Some elements should not be html labels, for example when they include sub-elements that contain labels (ex: a radio button that has a label on its own). Those are replaced with title elements
This commit is contained in:
clemkeirua 2020-03-05 16:57:08 +01:00 committed by GitHub Action
parent 62591623f4
commit 1a58dd69c2
4 changed files with 26 additions and 8 deletions

View file

@ -1,11 +1,10 @@
= form.label champ.main_value_name do
#{champ.libelle}
- if champ.mandatory?
%span.mandatory *
- if champ.updated_at.present? && seen_at.present?
%span.updated-at{ class: highlight_if_unseen_class(seen_at, champ.updated_at) }
= "modifié le #{try_format_datetime(champ.updated_at)}"
= # we do this trick because some html elements should use 'label' and some should be plain paragraphs
- if has_html_label?(champ)
%h2.label-not-label
= render partial: 'shared/dossiers/editable_champs/champ_label_content', locals: { champ: champ, seen_at: seen_at }
- else
= form.label champ.main_value_name do
= render partial: 'shared/dossiers/editable_champs/champ_label_content', locals: { champ: champ, seen_at: seen_at }
- if champ.description.present?
.notice{ id: describedby_id(champ) }= string_to_html(champ.description)

View file

@ -0,0 +1,7 @@
#{champ.libelle}
- if champ.mandatory?
%span.mandatory *
- if champ.updated_at.present? && seen_at.present?
%span.updated-at{ class: highlight_if_unseen_class(seen_at, champ.updated_at) }
= "modifié le #{try_format_datetime(champ.updated_at)}"