Remove ChampDecorator
This commit is contained in:
parent
b8f57415cd
commit
b41764ec03
8 changed files with 34 additions and 58 deletions
|
@ -9,4 +9,25 @@ module ChampHelper
|
|||
raw(champ.to_render_data.to_json)
|
||||
# rubocop:enable Rails/OutputSafety
|
||||
end
|
||||
|
||||
def formatted_value(champ)
|
||||
value = champ.value
|
||||
type = champ.type_champ
|
||||
|
||||
if type == TypeDeChamp.type_champs.fetch(:date) && value.present?
|
||||
Date.parse(value).strftime("%d/%m/%Y")
|
||||
elsif type.in? [TypeDeChamp.type_champs.fetch(:checkbox), TypeDeChamp.type_champs.fetch(:engagement)]
|
||||
value == 'on' ? 'Oui' : 'Non'
|
||||
elsif type == TypeDeChamp.type_champs.fetch(:yes_no)
|
||||
if value == 'true'
|
||||
'Oui'
|
||||
elsif value == 'false'
|
||||
'Non'
|
||||
end
|
||||
elsif type == TypeDeChamp.type_champs.fetch(:multiple_drop_down_list) && value.present?
|
||||
JSON.parse(value).join(', ')
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue