fix(dossier): should refresh dossier footer when removing options from multiselect

This commit is contained in:
Paul Chavard 2023-08-31 12:22:53 +02:00
parent dd85a495e0
commit 3a54e44b57
8 changed files with 28 additions and 13 deletions

View file

@ -62,8 +62,12 @@ class Champs::DropDownListChamp < Champ
options.include?(value)
end
def remove_option(options)
update_column(:value, nil)
def remove_option(options, touch = false)
if touch
update(value: nil)
else
update_column(:value, nil)
end
end
private

View file

@ -70,8 +70,12 @@ class Champs::LinkedDropDownListChamp < Champ
options.include?(primary_value) || options.include?(secondary_value)
end
def remove_option(options)
update_column(:value, nil)
def remove_option(options, touch = false)
if touch
update(value: nil)
else
update_column(:value, nil)
end
end
private

View file

@ -51,8 +51,13 @@ class Champs::MultipleDropDownListChamp < Champ
(selected_options - options).size != selected_options.size
end
def remove_option(options)
update_column(:value, (selected_options - options).to_json)
def remove_option(options, touch = false)
value = (selected_options - options).to_json
if touch
update(value:)
else
update_columns(value:)
end
end
def focusable_input_id