Use champ decorator to print dossier details

This commit is contained in:
Mathieu Magnin 2017-07-06 17:27:40 +02:00
parent 47857664eb
commit 8aed0d7aef
3 changed files with 7 additions and 6 deletions

View file

@ -6,6 +6,12 @@ class ChampDecorator < Draper::Decorator
Date.parse(object.value).strftime("%d/%m/%Y")
elsif type_champ == 'checkbox'
object.value == 'on' ? 'Oui' : 'Non'
elsif type_champ == 'yes_no'
if object.value == 'true'
'Oui'
elsif object.value == 'false'
'Non'
end
elsif type_champ == 'multiple_drop_down_list' && object.value.present?
JSON.parse(object.value).join(', ')
else

View file

@ -46,11 +46,6 @@
= dossier.text_summary
- else
Pas de dossier associé
- elsif champ.type_champ == 'yes_no'
- if champ.decorate.value == 'true'
Oui
- elsif champ.decorate.value == 'false'
Non
- else
= sanitize(champ.decorate.value)

View file

@ -9,7 +9,7 @@
- if @dossier.champs.present? && @dossier.champs.any?
%table.table
%tbody
- @dossier.champs.each do |c|
- @dossier.champs.decorate.each do |c|
%tr
%th
= "#{c.libelle} :"