pack drop_down stuff together
This commit is contained in:
parent
85684e3bea
commit
51e192939c
1 changed files with 14 additions and 14 deletions
|
@ -474,6 +474,20 @@ class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def drop_down_options
|
||||||
|
Array.wrap(super)
|
||||||
|
end
|
||||||
|
|
||||||
|
def drop_down_list_enabled_non_empty_options(other: false)
|
||||||
|
list_options = drop_down_options.reject(&:empty?)
|
||||||
|
|
||||||
|
if other && drop_down_other?
|
||||||
|
list_options + [[I18n.t('shared.champs.drop_down_list.other'), Champs::DropDownListChamp::OTHER]]
|
||||||
|
else
|
||||||
|
list_options
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def drop_down_list_value
|
def drop_down_list_value
|
||||||
if drop_down_options.present?
|
if drop_down_options.present?
|
||||||
drop_down_options.reject(&:empty?).join("\r\n")
|
drop_down_options.reject(&:empty?).join("\r\n")
|
||||||
|
@ -566,20 +580,6 @@ class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def drop_down_options
|
|
||||||
Array.wrap(super)
|
|
||||||
end
|
|
||||||
|
|
||||||
def drop_down_list_enabled_non_empty_options(other: false)
|
|
||||||
list_options = drop_down_options.reject(&:empty?)
|
|
||||||
|
|
||||||
if other && drop_down_other?
|
|
||||||
list_options + [[I18n.t('shared.champs.drop_down_list.other'), Champs::DropDownListChamp::OTHER]]
|
|
||||||
else
|
|
||||||
list_options
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def layer_enabled?(layer)
|
def layer_enabled?(layer)
|
||||||
options && options[layer] && options[layer] != '0'
|
options && options[layer] && options[layer] != '0'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue