feat(commune): display departement information on commune champ

This commit is contained in:
Paul Chavard 2021-11-30 19:39:25 +01:00
parent ed2cbdc966
commit fcbe364ac8
3 changed files with 32 additions and 4 deletions

View file

@ -50,7 +50,9 @@
color: $black;
}
.text-sm {
font-size: 14px;
}
.mt-1 {
margin-top: $default-spacer;

View file

@ -25,4 +25,25 @@ class Champs::CommuneChamp < Champs::TextChamp
def for_export
[value, external_id]
end
def name_departement
#FIXME we originaly saved already formatted departement with the code in the name
departement&.gsub(/^(.[0-9])\s-\s/, '')
end
def departement_code_and_name
"#{code_departement} - #{name_departement}"
end
def departement?
departement.present?
end
def code?
code.present?
end
def code
external_id
end
end

View file

@ -1,4 +1,9 @@
= format_text_value(champ.to_s)
- if champ.external_id.present?
Code INSEE :
= champ.external_id
- if champ.code?
%p.text-sm
Code INSEE :
= champ.code
- if champ.departement?
%br
Departement :
= champ.departement_code_and_name