Skip to content

Commit

Permalink
Merge branch 'MDL-53350' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Mar 8, 2016
2 parents 28a6a36 + 286d28b commit 9eede5b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 11 deletions.
Expand Up @@ -46,7 +46,7 @@ Y.extend(DDWTOS_DD, Y.Base, {
if (!this.get('readonly')) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
} else {
Y.later(500, this, this.position_drag_items, [pendingid]);
Y.later(500, this, this.position_drag_items, [pendingid, 3]);
Y.one('window').on('resize', function() {
this.position_drag_items(pendingid);
}, this);
Expand Down Expand Up @@ -305,11 +305,22 @@ Y.extend(DDWTOS_DD, Y.Base, {
remove_drag_from_drop : function (drop) {
this.place_drag_in_drop(null, drop);
},

/**
* Postition, or reposition, all the drag items.
* @param pendingid (optional) if given, then mark the js task complete after the
* items are all positioned.
* @param dotimeout (optional) if true, continually re-position the items so
* they stay in place. Else, if an integer, reposition this many times before stopping.
*/
position_drag_items : function (pendingid, dotimeout) {
Y.all(this.selectors.drags()).each(this.position_drag_item, this);
M.util.js_complete(pendingid);
if (dotimeout) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
if (dotimeout === true || dotimeout > 0) {
if (dotimeout !== true) {
dotimeout -= 1;
}
Y.later(500, this, this.position_drag_items, [pendingid, dotimeout]);
}
},
position_drag_item : function (drag) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -46,7 +46,7 @@ Y.extend(DDWTOS_DD, Y.Base, {
if (!this.get('readonly')) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
} else {
Y.later(500, this, this.position_drag_items, [pendingid]);
Y.later(500, this, this.position_drag_items, [pendingid, 3]);
Y.one('window').on('resize', function() {
this.position_drag_items(pendingid);
}, this);
Expand Down Expand Up @@ -305,11 +305,22 @@ Y.extend(DDWTOS_DD, Y.Base, {
remove_drag_from_drop : function (drop) {
this.place_drag_in_drop(null, drop);
},

/**
* Postition, or reposition, all the drag items.
* @param pendingid (optional) if given, then mark the js task complete after the
* items are all positioned.
* @param dotimeout (optional) if true, continually re-position the items so
* they stay in place. Else, if an integer, reposition this many times before stopping.
*/
position_drag_items : function (pendingid, dotimeout) {
Y.all(this.selectors.drags()).each(this.position_drag_item, this);
M.util.js_complete(pendingid);
if (dotimeout) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
if (dotimeout === true || dotimeout > 0) {
if (dotimeout !== true) {
dotimeout -= 1;
}
Y.later(500, this, this.position_drag_items, [pendingid, dotimeout]);
}
},
position_drag_item : function (drag) {
Expand Down
17 changes: 14 additions & 3 deletions question/type/ddwtos/yui/src/ddwtos/js/ddwtos.js
Expand Up @@ -44,7 +44,7 @@ Y.extend(DDWTOS_DD, Y.Base, {
if (!this.get('readonly')) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
} else {
Y.later(500, this, this.position_drag_items, [pendingid]);
Y.later(500, this, this.position_drag_items, [pendingid, 3]);
Y.one('window').on('resize', function() {
this.position_drag_items(pendingid);
}, this);
Expand Down Expand Up @@ -303,11 +303,22 @@ Y.extend(DDWTOS_DD, Y.Base, {
remove_drag_from_drop : function (drop) {
this.place_drag_in_drop(null, drop);
},

/**
* Postition, or reposition, all the drag items.
* @param pendingid (optional) if given, then mark the js task complete after the
* items are all positioned.
* @param dotimeout (optional) if true, continually re-position the items so
* they stay in place. Else, if an integer, reposition this many times before stopping.
*/
position_drag_items : function (pendingid, dotimeout) {
Y.all(this.selectors.drags()).each(this.position_drag_item, this);
M.util.js_complete(pendingid);
if (dotimeout) {
Y.later(500, this, this.position_drag_items, [pendingid, true]);
if (dotimeout === true || dotimeout > 0) {
if (dotimeout !== true) {
dotimeout -= 1;
}
Y.later(500, this, this.position_drag_items, [pendingid, dotimeout]);
}
},
position_drag_item : function (drag) {
Expand Down

0 comments on commit 9eede5b

Please sign in to comment.