Fix move type de champs
This commit is contained in:
parent
a708b071dd
commit
ee62d6fca4
1 changed files with 12 additions and 8 deletions
|
@ -595,7 +595,8 @@ class Procedure < ApplicationRecord
|
||||||
|
|
||||||
def move_type_de_champ_attributes(types_de_champ, type_de_champ, new_index)
|
def move_type_de_champ_attributes(types_de_champ, type_de_champ, new_index)
|
||||||
old_index = types_de_champ.index(type_de_champ)
|
old_index = types_de_champ.index(type_de_champ)
|
||||||
types_de_champ.insert(new_index, types_de_champ.delete_at(old_index))
|
if types_de_champ.delete_at(old_index)
|
||||||
|
types_de_champ.insert(new_index, type_de_champ)
|
||||||
.map.with_index do |type_de_champ, index|
|
.map.with_index do |type_de_champ, index|
|
||||||
{
|
{
|
||||||
id: type_de_champ.id,
|
id: type_de_champ.id,
|
||||||
|
@ -603,6 +604,9 @@ class Procedure < ApplicationRecord
|
||||||
order_place: index
|
order_place: index
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_publish
|
def before_publish
|
||||||
|
|
Loading…
Reference in a new issue