[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 YUI.add('moodle-tool_lp-dragdrop-reorder', function (Y, NAME) { 2 3 /** 4 * Simple drag and drop. 5 * 6 * Used when we just want a list of things that can be re-ordered by dragging. 7 * 8 * @class M.tool_lp.dragdrop_reorder 9 * @constructor 10 * @extends M.core.dragdrop 11 */ 12 var DRAGREORDER = function() { 13 DRAGREORDER.superclass.constructor.apply(this, arguments); 14 }; 15 16 var CSS = { 17 EDITINGMOVE: 'editing_move', 18 ICONCLASS: 'iconsmall' 19 }; 20 Y.extend(DRAGREORDER, M.core.dragdrop, { 21 initializer: function(args) { 22 if (Y.one('.' + args.parentNodeClass).all('.' + args.dragHandleInsertClass).size() <= 1) { 23 // We can't re-order when there is only one item. 24 return; 25 } 26 // Set group for parent class 27 this.groups = [args.group]; 28 this.samenodeclass = args.sameNodeClass; 29 this.parentnodeclass = args.parentNodeClass; 30 this.draghandleinsertclass = args.dragHandleInsertClass; 31 this.draghandle = this.get_drag_handle(args.dragHandleText, 32 CSS.EDITINGMOVE, CSS.ICONCLASS, true); 33 34 this.samenodelabel = args.sameNodeLabel; 35 this.parentnodelabel = args.parentNodeLabel; 36 this.callback = args.callback; 37 38 var delegate = new Y.DD.Delegate({ 39 container: '.' + args.parentNodeClass, 40 nodes: '.' + args.sameNodeClass, 41 target: true, 42 handles: ['.' + CSS.EDITINGMOVE], 43 dragConfig: {groups: this.groups} 44 }); 45 46 delegate.dd.plug(Y.Plugin.DDProxy); 47 48 Y.one('.' + args.parentNodeClass) 49 .all('.' + args.dragHandleInsertClass) 50 .each( 51 function(node) { 52 node.insert(this.draghandle.cloneNode(true)); 53 }, this); 54 }, 55 56 drop_hit: function(e) { 57 this.callback(e); 58 } 59 60 }, { 61 NAME: 'tool_lp-dragdrop-reorder', 62 ATTRS: { 63 } 64 }); 65 66 M.tool_lp = M.tool_lp || {}; 67 M.tool_lp.dragdrop_reorder = function(params) { 68 return new DRAGREORDER(params); 69 }; 70 71 72 }, '@VERSION@', {"requires": ["moodle-core-dragdrop"]});
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |