[#1421] Move pays to PaysChamp

This commit is contained in:
Frederic Merizen 2018-06-15 14:37:43 +02:00 committed by Pierre de La Morinerie
parent 0239f936d7
commit e99931527b
4 changed files with 5 additions and 6 deletions

View file

@ -19,10 +19,6 @@ class Champ < ApplicationRecord
mandatory? && value.blank?
end
def self.pays
JSON.parse(Carto::GeoAPI::Driver.pays).pluck("nom")
end
def to_s
if value.present?
string_value

View file

@ -1,2 +1,5 @@
class Champs::PaysChamp < Champs::TextChamp
def self.pays
JSON.parse(Carto::GeoAPI::Driver.pays).pluck("nom")
end
end

View file

@ -1,3 +1,3 @@
= form.select :value,
Champ.pays,
Champs::PaysChamp.pays,
required: champ.mandatory?

View file

@ -1,2 +1,2 @@
= select_tag("champs['#{champ.id}']",
options_for_select(Champ.pays, selected: champ.object.value))
options_for_select(Champs::PaysChamp.pays, selected: champ.object.value))