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

This commit is contained in:
Deepa Jayaprakash
2016-09-29 16:47:52 +01:00
parent 43f53ff0f5
commit 411fdd46c5
4 changed files with 38 additions and 26 deletions
@@ -383,9 +383,12 @@ Y.extend(DRAGDROP, Y.Base, {
// Search for possible drop targets.
var droptargets = Y.all('.' + this.samenodeclass + ', .' + this.parentnodeclass);
droptargets.each(function (node) {
droptargets.each(function(node) {
var validdrop = false, 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 {
@@ -393,12 +396,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
+12 -8
View File
@@ -383,9 +383,12 @@ Y.extend(DRAGDROP, Y.Base, {
// Search for possible drop targets.
var droptargets = Y.all('.' + this.samenodeclass + ', .' + this.parentnodeclass);
droptargets.each(function (node) {
droptargets.each(function(node) {
var validdrop = false, 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 {
@@ -393,12 +396,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) {
+12 -8
View File
@@ -381,9 +381,12 @@ Y.extend(DRAGDROP, Y.Base, {
// Search for possible drop targets.
var droptargets = Y.all('.' + this.samenodeclass + ', .' + this.parentnodeclass);
droptargets.each(function (node) {
droptargets.each(function(node) {
var validdrop = false, 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 {
@@ -391,12 +394,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) {