MDL-55861 course: Click drag&drop icon, incorrect activities shown

This commit is contained in:
Deepa Jayaprakash 2016-09-12 10:36:41 +01:00
parent ddd8dc0d1b
commit 9b24ebd665
4 changed files with 35 additions and 23 deletions

View File

@ -422,7 +422,10 @@ Y.extend(DRAGDROP, Y.Base, {
droptargets.each(function(node) {
var validdrop = false;
var labelroot = node;
if (node.drop && node.drop.inGroup(this.groups) && node.drop.get('node') !== dragcontainer) {
var className = node.getAttribute("class").split(' ').join(', .');
if (node.drop && node.drop.inGroup(this.groups) && node.drop.get('node') !== dragcontainer &&
node.next(className) !== dragcontainer) {
// This is a drag and drop target with the same class as the grabbed node.
validdrop = true;
} else {
@ -430,12 +433,13 @@ Y.extend(DRAGDROP, Y.Base, {
var i, j;
for (i = 0; i < elementgroups.length; i++) {
for (j = 0; j < this.groups.length; j++) {
if (elementgroups[i] === this.groups[j]) {
// This is a parent node of the grabbed node (used for dropping in empty sections).
validdrop = true;
// This node will have no text - so we get the first valid text from the parent.
labelroot = node.get('parentNode');
break;
if (elementgroups[i] === this.groups[j] && !(node == dragcontainer ||
node.next(className) === dragcontainer || node.get('children').item(0) == dragcontainer)) {
// This is a parent node of the grabbed node (used for dropping in empty sections).
validdrop = true;
// This node will have no text - so we get the first valid text from the parent.
labelroot = node.get('parentNode');
break;
}
}
if (validdrop) {

File diff suppressed because one or more lines are too long

View File

@ -422,7 +422,10 @@ Y.extend(DRAGDROP, Y.Base, {
droptargets.each(function(node) {
var validdrop = false;
var labelroot = node;
if (node.drop && node.drop.inGroup(this.groups) && node.drop.get('node') !== dragcontainer) {
var className = node.getAttribute("class").split(' ').join(', .');
if (node.drop && node.drop.inGroup(this.groups) && node.drop.get('node') !== dragcontainer &&
node.next(className) !== dragcontainer) {
// This is a drag and drop target with the same class as the grabbed node.
validdrop = true;
} else {
@ -430,12 +433,13 @@ Y.extend(DRAGDROP, Y.Base, {
var i, j;
for (i = 0; i < elementgroups.length; i++) {
for (j = 0; j < this.groups.length; j++) {
if (elementgroups[i] === this.groups[j]) {
// This is a parent node of the grabbed node (used for dropping in empty sections).
validdrop = true;
// This node will have no text - so we get the first valid text from the parent.
labelroot = node.get('parentNode');
break;
if (elementgroups[i] === this.groups[j] && !(node == dragcontainer ||
node.next(className) === dragcontainer || node.get('children').item(0) == dragcontainer)) {
// This is a parent node of the grabbed node (used for dropping in empty sections).
validdrop = true;
// This node will have no text - so we get the first valid text from the parent.
labelroot = node.get('parentNode');
break;
}
}
if (validdrop) {

View File

@ -420,7 +420,10 @@ Y.extend(DRAGDROP, Y.Base, {
droptargets.each(function(node) {
var validdrop = false;
var labelroot = node;
if (node.drop && node.drop.inGroup(this.groups) && node.drop.get('node') !== dragcontainer) {
var className = node.getAttribute("class").split(' ').join(', .');
if (node.drop && node.drop.inGroup(this.groups) && node.drop.get('node') !== dragcontainer &&
node.next(className) !== dragcontainer) {
// This is a drag and drop target with the same class as the grabbed node.
validdrop = true;
} else {
@ -428,12 +431,13 @@ Y.extend(DRAGDROP, Y.Base, {
var i, j;
for (i = 0; i < elementgroups.length; i++) {
for (j = 0; j < this.groups.length; j++) {
if (elementgroups[i] === this.groups[j]) {
// This is a parent node of the grabbed node (used for dropping in empty sections).
validdrop = true;
// This node will have no text - so we get the first valid text from the parent.
labelroot = node.get('parentNode');
break;
if (elementgroups[i] === this.groups[j] && !(node == dragcontainer ||
node.next(className) === dragcontainer || node.get('children').item(0) == dragcontainer)) {
// This is a parent node of the grabbed node (used for dropping in empty sections).
validdrop = true;
// This node will have no text - so we get the first valid text from the parent.
labelroot = node.get('parentNode');
break;
}
}
if (validdrop) {