mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Delete module from canvas when moving
This commit is contained in:
parent
0cdea0b51a
commit
77f75fdeb6
1 changed files with 13 additions and 0 deletions
|
@ -1843,6 +1843,9 @@ function initMoveModules() {
|
|||
moveVal[moduleEl.attr("id")] = moveToExperimentId;
|
||||
formMoveInput.attr("value", JSON.stringify(moveVal));
|
||||
|
||||
// Delete module from canvas
|
||||
deleteModule(moduleEl.attr("id"));
|
||||
|
||||
// Hide modal
|
||||
modal.modal("hide");
|
||||
}
|
||||
|
@ -1999,10 +2002,20 @@ function deleteModule(id, linkConnections) {
|
|||
var formAddNamesInput = $('#update-canvas form input#add-names');
|
||||
var formClonedInput = $('#update-canvas form input#cloned');
|
||||
var formRemoveInput = $('#update-canvas form input#remove');
|
||||
var formMoveInput = $('#update-canvas form input#move');
|
||||
var inputVal, newVal;
|
||||
var vals, idx;
|
||||
var addToRemoveList = true;
|
||||
|
||||
// If the module was moved, we don't need to do anything with it
|
||||
inputVal = formMoveInput.attr("value");
|
||||
if (!_.isUndefined(inputVal) && inputVal !== "") {
|
||||
if (_.contains(inputVal, id)) {
|
||||
addToRemoveList = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If the module we are deleting was added via JS
|
||||
// (and hasn't been saved yet), we don't need to "add" it
|
||||
// neither "remove" it, it simply ceases to exist
|
||||
|
|
Loading…
Reference in a new issue