Revert for_api value on yes_no champs

This commit is contained in:
Paul Chavard 2019-01-29 14:37:57 +01:00
parent 7c59f953e3
commit 7678d8eb0b
3 changed files with 69 additions and 19 deletions

View file

@ -1,19 +1,9 @@
class Champs::CheckboxChamp < Champ
def search_terms
if value == 'on'
[libelle]
end
end
def to_s
value == 'on' ? 'Oui' : 'Non'
class Champs::CheckboxChamp < Champs::YesNoChamp
def true?
value == 'on'
end
def for_export
value == 'on' ? 'on' : 'off'
end
def for_api
value == 'on' ? 'on' : 'off'
true? ? 'on' : 'off'
end
end

View file

@ -1,6 +1,6 @@
class Champs::YesNoChamp < Champs::CheckboxChamp
class Champs::YesNoChamp < Champ
def search_terms
if value == 'true'
if true?
[libelle]
end
end
@ -13,13 +13,13 @@ class Champs::YesNoChamp < Champs::CheckboxChamp
processed_value
end
def for_api
processed_value
def true?
value == 'true'
end
private
def processed_value
value == 'true' ? 'Oui' : 'Non'
true? ? 'Oui' : 'Non'
end
end