Improuve champ blank check
This commit is contained in:
parent
38b73f0fee
commit
ac0f50b488
6 changed files with 39 additions and 18 deletions
|
@ -95,14 +95,7 @@ class Champ < ApplicationRecord
|
|||
end
|
||||
|
||||
def blank?
|
||||
case type_de_champ.type_champ
|
||||
when TypeDeChamp.type_champs.fetch(:carte)
|
||||
geo_areas.blank? || value == '[]'
|
||||
when TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)
|
||||
value.blank? || value == '[]'
|
||||
else
|
||||
value.blank?
|
||||
end
|
||||
value.blank?
|
||||
end
|
||||
|
||||
def search_terms
|
||||
|
|
|
@ -109,6 +109,10 @@ class Champs::CarteChamp < Champ
|
|||
nil
|
||||
end
|
||||
|
||||
def blank?
|
||||
geo_areas.blank?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def selection_utilisateur_legacy_geometry
|
||||
|
|
|
@ -62,6 +62,10 @@ class Champs::MultipleDropDownListChamp < Champ
|
|||
enabled_non_empty_options.size <= THRESHOLD_NB_OPTIONS_AS_CHECKBOX
|
||||
end
|
||||
|
||||
def blank?
|
||||
selected_options.blank?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def format_before_save
|
||||
|
|
|
@ -30,8 +30,8 @@ class Champs::RepetitionChamp < Champ
|
|||
end
|
||||
end
|
||||
|
||||
def mandatory_and_blank?
|
||||
mandatory? && champs.empty?
|
||||
def blank?
|
||||
champs.empty?
|
||||
end
|
||||
|
||||
def search_terms
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue