Rename DropDownList#selected_options_without_decorator
This commit is contained in:
parent
4b4eb6d53e
commit
c4b9a0b79e
3 changed files with 5 additions and 5 deletions
|
@ -2,7 +2,7 @@ class Champs::MultipleDropDownListChamp < Champ
|
||||||
before_save :format_before_save
|
before_save :format_before_save
|
||||||
|
|
||||||
def search_terms
|
def search_terms
|
||||||
drop_down_list.selected_options_without_decorator(self)
|
drop_down_list.selected_options(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -20,10 +20,10 @@ class Champs::MultipleDropDownListChamp < Champ
|
||||||
end
|
end
|
||||||
|
|
||||||
def string_value
|
def string_value
|
||||||
drop_down_list.selected_options_without_decorator(self).join(', ')
|
drop_down_list.selected_options(self).join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
def value_for_export
|
def value_for_export
|
||||||
drop_down_list.selected_options_without_decorator(self).join(', ')
|
drop_down_list.selected_options(self).join(', ')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ class DropDownList < ApplicationRecord
|
||||||
options.select { |v| (v =~ /^--.*--$/).present? }
|
options.select { |v| (v =~ /^--.*--$/).present? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def selected_options_without_decorator(champ)
|
def selected_options(champ)
|
||||||
champ.value.blank? ? [] : multiple ? JSON.parse(champ.value) : [champ.value]
|
champ.value.blank? ? [] : multiple ? JSON.parse(champ.value) : [champ.value]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- if champ.drop_down_list && champ.drop_down_list.options.any?
|
- if champ.drop_down_list && champ.drop_down_list.options.any?
|
||||||
= form.select :value,
|
= form.select :value,
|
||||||
champ.drop_down_list.options,
|
champ.drop_down_list.options,
|
||||||
{ selected: champ.drop_down_list.selected_options_without_decorator(champ),
|
{ selected: champ.drop_down_list.selected_options(champ),
|
||||||
disabled: champ.drop_down_list.disabled_options },
|
disabled: champ.drop_down_list.disabled_options },
|
||||||
multiple: true,
|
multiple: true,
|
||||||
class: 'select2'
|
class: 'select2'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue