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:
parent
62591623f4
commit
1a58dd69c2
4 changed files with 26 additions and 8 deletions
|
@ -373,6 +373,12 @@
|
|||
margin-bottom: $default-padding;
|
||||
}
|
||||
|
||||
.label-not-label {
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
margin-bottom: $default-padding;
|
||||
}
|
||||
|
||||
.explication {
|
||||
margin-bottom: $default-fields-spacer;
|
||||
padding: $default-padding / 2;
|
||||
|
|
|
@ -4,6 +4,12 @@ module ChampHelper
|
|||
!types_without_label.include?(champ.type_champ)
|
||||
end
|
||||
|
||||
def has_html_label?(champ)
|
||||
types_with_no_html_label = [TypeDeChamp.type_champs.fetch(:civilite), TypeDeChamp.type_champs.fetch(:yes_no), TypeDeChamp.type_champs.fetch(:datetime), TypeDeChamp.type_champs.fetch(:piece_justificative)
|
||||
]
|
||||
types_with_no_html_label.include?(champ.type_champ)
|
||||
end
|
||||
|
||||
def geo_data(champ)
|
||||
# rubocop:disable Rails/OutputSafety
|
||||
raw(champ.to_render_data.to_json)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
= # 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
|
||||
#{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)}"
|
||||
= 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)
|
||||
|
|
|
@ -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)}"
|
Loading…
Reference in a new issue