Fixed bug where popovers on operations stopped working after the operation was dragged into the recipe.

feature-extract-files
n1474335 2017-04-27 09:10:18 +00:00
parent be231f3a91
commit e4c5c4a901
1 changed files with 6 additions and 2 deletions

View File

@ -76,21 +76,25 @@ RecipeWaiter.prototype.initialiseOperationDragNDrop = function() {
/** /**
* Creates a drag-n-droppable seed list of operations. * Creates a drag-n-droppable seed list of operations.
* *
* @param {element} listEl - The list the initialise * @param {element} listEl - The list to initialise
*/ */
RecipeWaiter.prototype.createSortableSeedList = function(listEl) { RecipeWaiter.prototype.createSortableSeedList = function(listEl) {
Sortable.create(listEl, { Sortable.create(listEl, {
group: { group: {
name: "recipe", name: "recipe",
pull: "clone", pull: "clone",
put: false put: false,
}, },
sort: false, sort: false,
setData: function(dataTransfer, dragEl) { setData: function(dataTransfer, dragEl) {
dataTransfer.setData("Text", dragEl.textContent); dataTransfer.setData("Text", dragEl.textContent);
}, },
onStart: function(evt) { onStart: function(evt) {
// Removes popover element and event bindings from the dragged operation but not the
// event bindings from the one left in the operations list. Without manually removing
// these bindings, we cannot re-initialise the popover on the stub operation.
$(evt.item).popover("destroy"); $(evt.item).popover("destroy");
$(evt.clone).off(".popover").removeData("bs.popover");
evt.item.setAttribute("data-toggle", "popover-disabled"); evt.item.setAttribute("data-toggle", "popover-disabled");
}, },
onEnd: this.opSortEnd.bind(this) onEnd: this.opSortEnd.bind(this)