From 2308b3bc5cc9fd1b1c72bb508651de58f1a152a4 Mon Sep 17 00:00:00 2001 From: maatinito <15379878+maatinito@users.noreply.github.com> Date: Mon, 29 Apr 2019 10:55:10 -1000 Subject: [PATCH] =?UTF-8?q?[Fix=203827]=20Champ=20Pays:=20la=20ligne=20de?= =?UTF-8?q?=20tirets=20ne=20devrait=20pas=20=C3=AAtre=20selectionnable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/champs/pays_champ.rb | 4 ++++ app/views/shared/dossiers/editable_champs/_pays.html.haml | 1 + 2 files changed, 5 insertions(+) diff --git a/app/models/champs/pays_champ.rb b/app/models/champs/pays_champ.rb index d088d2880..78de3277f 100644 --- a/app/models/champs/pays_champ.rb +++ b/app/models/champs/pays_champ.rb @@ -2,4 +2,8 @@ class Champs::PaysChamp < Champs::TextChamp def self.pays ApiGeo::API.pays.pluck(:nom) end + + def self.disabled_options + pays.select { |v| (v =~ /^--.*--$/).present? } + end end diff --git a/app/views/shared/dossiers/editable_champs/_pays.html.haml b/app/views/shared/dossiers/editable_champs/_pays.html.haml index af0ee8b74..13062d8e5 100644 --- a/app/views/shared/dossiers/editable_champs/_pays.html.haml +++ b/app/views/shared/dossiers/editable_champs/_pays.html.haml @@ -1,4 +1,5 @@ = form.select :value, Champs::PaysChamp.pays, + disabled: Champs::PaysChamp.disabled_options, include_blank: true, required: champ.mandatory?