blacklight_folders 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27067bbaefd718b0c485c4c1f13941fcb53a6e8b
4
- data.tar.gz: cbb26a51baaed6c6f17f499d1d46b47254f6c669
3
+ metadata.gz: 4844ef575ba8049efa2c73749f125071046f908a
4
+ data.tar.gz: bea1a0a9337315f3988a8abb5b2eaa15993e2772
5
5
  SHA512:
6
- metadata.gz: 5cd3259a5737051c56a80e8346d48b7379062141b285baa1b2abae6917470c8e4c41a1134855627674f16b1745e837f279e1d058265eef06990088fc58c560e5
7
- data.tar.gz: d7f809c3483b7c176083f6f5b1cfd6d2fb12a4e578f086289b293e87d44d0e24fe5239b09f8138a265bfbf95fff19979d171122004966ea6822ef878d559b14a
6
+ metadata.gz: ed3ef129346a5a5f7071edc8147c709386dbc70dca63e1901ea9bc3c58026632f714a43d65b208710f004981a49b23c6434d72d9585ca56233bdcd5d9ce806ba
7
+ data.tar.gz: 2c3e7b5e59c33161ed409452f33af4a55b9d3aa4f41247fe8f97513323f464338cc1e8d1d8760a4387e2b7135aeeb7107ed70ae6e8885a99a0e3bde61eb7deda
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Folders
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -0,0 +1,646 @@
1
+ /*!
2
+ * Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
3
+ * Dual-licensed under the BSD or MIT licenses
4
+ */
5
+ ;(function($, window, document, undefined)
6
+ {
7
+ var hasTouch = 'ontouchstart' in window;
8
+ var nestableCopy;
9
+
10
+ /**
11
+ * Detect CSS pointer-events property
12
+ * events are normally disabled on the dragging element to avoid conflicts
13
+ * https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js
14
+ */
15
+ var hasPointerEvents = (function()
16
+ {
17
+ var el = document.createElement('div'),
18
+ docEl = document.documentElement;
19
+ if (!('pointerEvents' in el.style)) {
20
+ return false;
21
+ }
22
+ el.style.pointerEvents = 'auto';
23
+ el.style.pointerEvents = 'x';
24
+ docEl.appendChild(el);
25
+ var supports = window.getComputedStyle && window.getComputedStyle(el, '').pointerEvents === 'auto';
26
+ docEl.removeChild(el);
27
+ return !!supports;
28
+ })();
29
+
30
+ var eStart = hasTouch ? 'touchstart' : 'mousedown',
31
+ eMove = hasTouch ? 'touchmove' : 'mousemove',
32
+ eEnd = hasTouch ? 'touchend' : 'mouseup',
33
+ eCancel = hasTouch ? 'touchcancel' : 'mouseup';
34
+
35
+ var defaults = {
36
+ listNodeName : 'ol',
37
+ itemNodeName : 'li',
38
+ rootClass : 'dd',
39
+ listClass : 'dd-list',
40
+ itemClass : 'dd-item',
41
+ dragClass : 'dd-dragel',
42
+ handleClass : 'dd-handle',
43
+ collapsedClass : 'dd-collapsed',
44
+ placeClass : 'dd-placeholder',
45
+ noDragClass : 'dd-nodrag',
46
+ noChildrenClass : 'dd-nochildren',
47
+ emptyClass : 'dd-empty',
48
+ expandBtnHTML : '<button data-action="expand" type="button">Expand</button>',
49
+ collapseBtnHTML : '<button data-action="collapse" type="button">Collapse</button>',
50
+ group : 0,
51
+ maxDepth : 5,
52
+ threshold : 20,
53
+ reject : [],
54
+ //method for call when an item has been successfully dropped
55
+ //method has 1 argument in which sends an object containing all
56
+ //necessary details
57
+ dropCallback : null,
58
+ // When a node is dragged it is moved to its new location.
59
+ // You can set the next option to true to create a copy of the node that is dragged.
60
+ cloneNodeOnDrag : false,
61
+ // When the node is dragged and released outside its list delete it.
62
+ dragOutsideToDelete : false
63
+ };
64
+
65
+ function Plugin(element, options)
66
+ {
67
+ this.w = $(document);
68
+ this.el = $(element);
69
+ this.options = $.extend({}, defaults, options);
70
+ this.init();
71
+ }
72
+
73
+ Plugin.prototype = {
74
+
75
+ init: function()
76
+ {
77
+ var list = this;
78
+
79
+ list.reset();
80
+
81
+ list.el.data('nestable-group', this.options.group);
82
+
83
+ list.placeEl = $('<div class="' + list.options.placeClass + '"/>');
84
+
85
+ $.each(this.el.find(list.options.itemNodeName), function(k, el) {
86
+ list.setParent($(el));
87
+ });
88
+
89
+ list.el.on('click', 'button', function(e)
90
+ {
91
+ if (list.dragEl || (!hasTouch && e.button !== 0)) {
92
+ return;
93
+ }
94
+ var target = $(e.currentTarget),
95
+ action = target.data('action'),
96
+ item = target.parent(list.options.itemNodeName);
97
+ if (action === 'collapse') {
98
+ list.collapseItem(item);
99
+ }
100
+ if (action === 'expand') {
101
+ list.expandItem(item);
102
+ }
103
+ });
104
+
105
+ var onStartEvent = function(e)
106
+ {
107
+ var handle = $(e.target);
108
+
109
+ list.nestableCopy = handle.closest('.'+list.options.rootClass).clone(true);
110
+
111
+ if (!handle.hasClass(list.options.handleClass)) {
112
+ if (handle.closest('.' + list.options.noDragClass).length) {
113
+ return;
114
+ }
115
+ handle = handle.closest('.' + list.options.handleClass);
116
+ }
117
+ if (!handle.length || list.dragEl || (!hasTouch && e.which !== 1) || (hasTouch && e.touches.length !== 1)) {
118
+ return;
119
+ }
120
+ e.preventDefault();
121
+ list.dragStart(hasTouch ? e.touches[0] : e);
122
+ };
123
+
124
+ var onMoveEvent = function(e)
125
+ {
126
+ if (list.dragEl) {
127
+ e.preventDefault();
128
+ list.dragMove(hasTouch ? e.touches[0] : e);
129
+ }
130
+ };
131
+
132
+ var onEndEvent = function(e)
133
+ {
134
+ if (list.dragEl) {
135
+ e.preventDefault();
136
+ list.dragStop(hasTouch ? e.touches[0] : e);
137
+ }
138
+ };
139
+
140
+ if (hasTouch) {
141
+ list.el[0].addEventListener(eStart, onStartEvent, false);
142
+ window.addEventListener(eMove, onMoveEvent, false);
143
+ window.addEventListener(eEnd, onEndEvent, false);
144
+ window.addEventListener(eCancel, onEndEvent, false);
145
+ } else {
146
+ list.el.on(eStart, onStartEvent);
147
+ list.w.on(eMove, onMoveEvent);
148
+ list.w.on(eEnd, onEndEvent);
149
+ }
150
+
151
+ var destroyNestable = function()
152
+ {
153
+ if (hasTouch) {
154
+ list.el[0].removeEventListener(eStart, onStartEvent, false);
155
+ window.removeEventListener(eMove, onMoveEvent, false);
156
+ window.removeEventListener(eEnd, onEndEvent, false);
157
+ window.removeEventListener(eCancel, onEndEvent, false);
158
+ } else {
159
+ list.el.off(eStart, onStartEvent);
160
+ list.w.off(eMove, onMoveEvent);
161
+ list.w.off(eEnd, onEndEvent);
162
+ }
163
+
164
+ list.el.off('click');
165
+ list.el.unbind('destroy-nestable');
166
+
167
+ list.el.data("nestable", null);
168
+
169
+ var buttons = list.el[0].getElementsByTagName('button');
170
+
171
+ $(buttons).remove();
172
+ };
173
+
174
+ list.el.bind('destroy-nestable', destroyNestable);
175
+ },
176
+
177
+ destroy: function ()
178
+ {
179
+ this.expandAll();
180
+ this.el.trigger('destroy-nestable');
181
+ },
182
+
183
+ serialize: function()
184
+ {
185
+ var data,
186
+ depth = 0,
187
+ list = this;
188
+ step = function(level, depth)
189
+ {
190
+ var array = [ ],
191
+ items = level.children(list.options.itemNodeName);
192
+ items.each(function()
193
+ {
194
+ var li = $(this),
195
+ item = $.extend({}, li.data()),
196
+ sub = li.children(list.options.listNodeName);
197
+ if (sub.length) {
198
+ item.children = step(sub, depth + 1);
199
+ }
200
+ array.push(item);
201
+ });
202
+ return array;
203
+ };
204
+ var el;
205
+
206
+ if (list.el.is(list.options.listNodeName)) {
207
+ el = list.el;
208
+ } else {
209
+ el = list.el.find(list.options.listNodeName).first();
210
+ }
211
+ data = step(el, depth);
212
+
213
+ return data;
214
+ },
215
+
216
+ reset: function()
217
+ {
218
+ this.mouse = {
219
+ offsetX : 0,
220
+ offsetY : 0,
221
+ startX : 0,
222
+ startY : 0,
223
+ lastX : 0,
224
+ lastY : 0,
225
+ nowX : 0,
226
+ nowY : 0,
227
+ distX : 0,
228
+ distY : 0,
229
+ dirAx : 0,
230
+ dirX : 0,
231
+ dirY : 0,
232
+ lastDirX : 0,
233
+ lastDirY : 0,
234
+ distAxX : 0,
235
+ distAxY : 0
236
+ };
237
+ this.moving = false;
238
+ this.dragEl = null;
239
+ this.dragRootEl = null;
240
+ this.dragDepth = 0;
241
+ this.dragItem = null;
242
+ this.hasNewRoot = false;
243
+ this.pointEl = null;
244
+ this.sourceRoot = null;
245
+ this.isOutsideRoot = false;
246
+ },
247
+
248
+ expandItem: function(li)
249
+ {
250
+ li.removeClass(this.options.collapsedClass);
251
+ li.children('[data-action="expand"]').hide();
252
+ li.children('[data-action="collapse"]').show();
253
+ li.children(this.options.listNodeName).show();
254
+ this.el.trigger('expand', [li]);
255
+ li.trigger('expand');
256
+ },
257
+
258
+ collapseItem: function(li)
259
+ {
260
+ var lists = li.children(this.options.listNodeName);
261
+ if (lists.length) {
262
+ li.addClass(this.options.collapsedClass);
263
+ li.children('[data-action="collapse"]').hide();
264
+ li.children('[data-action="expand"]').show();
265
+ li.children(this.options.listNodeName).hide();
266
+ }
267
+ this.el.trigger('collapse', [li]);
268
+ li.trigger('collapse');
269
+ },
270
+
271
+ expandAll: function()
272
+ {
273
+ var list = this;
274
+ list.el.find(list.options.itemNodeName).each(function() {
275
+ list.expandItem($(this));
276
+ });
277
+ },
278
+
279
+ collapseAll: function()
280
+ {
281
+ var list = this;
282
+ list.el.find(list.options.itemNodeName).each(function() {
283
+ list.collapseItem($(this));
284
+ });
285
+ },
286
+
287
+ setParent: function(li)
288
+ {
289
+ if (li.children(this.options.listNodeName).length) {
290
+ li.prepend($(this.options.expandBtnHTML));
291
+ li.prepend($(this.options.collapseBtnHTML));
292
+ }
293
+ if( (' ' + li[0].className + ' ').indexOf(' ' + defaults.collapsedClass + ' ') > -1 )
294
+ {
295
+ li.children('[data-action="collapse"]').hide();
296
+ } else {
297
+ li.children('[data-action="expand"]').hide();
298
+ }
299
+ },
300
+
301
+ unsetParent: function(li)
302
+ {
303
+ li.removeClass(this.options.collapsedClass);
304
+ li.children('[data-action]').remove();
305
+ li.children(this.options.listNodeName).remove();
306
+ },
307
+
308
+ dragStart: function(e)
309
+ {
310
+ var mouse = this.mouse,
311
+ target = $(e.target),
312
+ dragItem = target.closest('.' + this.options.handleClass).closest(this.options.itemNodeName);
313
+
314
+ this.sourceRoot = target.closest('.' + this.options.rootClass);
315
+
316
+ this.dragItem = dragItem;
317
+
318
+ this.placeEl.css('height', dragItem.height());
319
+
320
+ mouse.offsetX = e.offsetX !== undefined ? e.offsetX : e.pageX - target.offset().left;
321
+ mouse.offsetY = e.offsetY !== undefined ? e.offsetY : e.pageY - target.offset().top;
322
+ mouse.startX = mouse.lastX = e.pageX;
323
+ mouse.startY = mouse.lastY = e.pageY;
324
+
325
+ this.dragRootEl = this.el;
326
+
327
+ this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
328
+ this.dragEl.css('width', dragItem.width());
329
+
330
+ // fix for zepto.js
331
+ //dragItem.after(this.placeEl).detach().appendTo(this.dragEl);
332
+ if(this.options.cloneNodeOnDrag) {
333
+ dragItem.after(dragItem.clone());
334
+ } else {
335
+ dragItem.after(this.placeEl);
336
+ }
337
+ dragItem[0].parentNode.removeChild(dragItem[0]);
338
+ dragItem.appendTo(this.dragEl);
339
+
340
+ $(document.body).append(this.dragEl);
341
+ this.dragEl.css({
342
+ 'left' : e.pageX - mouse.offsetX,
343
+ 'top' : e.pageY - mouse.offsetY
344
+ });
345
+ // total depth of dragging item
346
+ var i, depth,
347
+ items = this.dragEl.find(this.options.itemNodeName);
348
+ for (i = 0; i < items.length; i++) {
349
+ depth = $(items[i]).parents(this.options.listNodeName).length;
350
+ if (depth > this.dragDepth) {
351
+ this.dragDepth = depth;
352
+ }
353
+ }
354
+ },
355
+
356
+ dragStop: function(e)
357
+ {
358
+ // fix for zepto.js
359
+ //this.placeEl.replaceWith(this.dragEl.children(this.options.itemNodeName + ':first').detach());
360
+ var el = this.dragEl.children(this.options.itemNodeName).first();
361
+ el[0].parentNode.removeChild(el[0]);
362
+
363
+ if(this.isOutsideRoot && this.options.dragOutsideToDelete)
364
+ {
365
+ var parent = this.placeEl.parent();
366
+ this.placeEl.remove();
367
+ if (!parent.children().length) {
368
+ this.unsetParent(parent.parent());
369
+ }
370
+ // If all nodes where deleted, create a placeholder element.
371
+ if (!this.dragRootEl.find(this.options.itemNodeName).length)
372
+ {
373
+ this.dragRootEl.append('<div class="' + this.options.emptyClass + '"/>');
374
+ }
375
+ }
376
+ else
377
+ {
378
+ this.placeEl.replaceWith(el);
379
+ }
380
+
381
+ if (!this.moving)
382
+ {
383
+ $(this.dragItem).trigger('click');
384
+ }
385
+
386
+ var i;
387
+ var isRejected = false;
388
+ for (i in this.options.reject)
389
+ {
390
+ var reject = this.options.reject[i];
391
+ if (reject.rule.apply(this.dragRootEl))
392
+ {
393
+ var nestableDragEl = el.clone(true);
394
+ this.dragRootEl.html(this.nestableCopy.children().clone(true));
395
+ if (reject.action) {
396
+ reject.action.apply(this.dragRootEl, [nestableDragEl]);
397
+ }
398
+
399
+ isRejected = true;
400
+ break;
401
+ }
402
+ }
403
+
404
+ if (!isRejected)
405
+ {
406
+ this.dragEl.remove();
407
+ this.el.trigger('change');
408
+
409
+ //Let's find out new parent id
410
+ var parentItem = el.parent().parent();
411
+ var parentId = null;
412
+ if(parentItem !== null && !parentItem.is('.' + this.options.rootClass))
413
+ parentId = parentItem.data('id');
414
+
415
+ if($.isFunction(this.options.dropCallback))
416
+ {
417
+ var details = {
418
+ sourceId : el.data('id'),
419
+ destId : parentId,
420
+ sourceEl : el,
421
+ destParent : parentItem,
422
+ destRoot : el.closest('.' + this.options.rootClass),
423
+ sourceRoot : this.sourceRoot
424
+ };
425
+ this.options.dropCallback.call(this, details);
426
+ }
427
+
428
+ if (this.hasNewRoot) {
429
+ this.dragRootEl.trigger('change');
430
+ }
431
+
432
+ this.reset();
433
+ }
434
+ },
435
+
436
+ dragMove: function(e)
437
+ {
438
+ var list, parent, prev, next, depth,
439
+ opt = this.options,
440
+ mouse = this.mouse;
441
+
442
+ this.dragEl.css({
443
+ 'left' : e.pageX - mouse.offsetX,
444
+ 'top' : e.pageY - mouse.offsetY
445
+ });
446
+
447
+ // mouse position last events
448
+ mouse.lastX = mouse.nowX;
449
+ mouse.lastY = mouse.nowY;
450
+ // mouse position this events
451
+ mouse.nowX = e.pageX;
452
+ mouse.nowY = e.pageY;
453
+ // distance mouse moved between events
454
+ mouse.distX = mouse.nowX - mouse.lastX;
455
+ mouse.distY = mouse.nowY - mouse.lastY;
456
+ // direction mouse was moving
457
+ mouse.lastDirX = mouse.dirX;
458
+ mouse.lastDirY = mouse.dirY;
459
+ // direction mouse is now moving (on both axis)
460
+ mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
461
+ mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
462
+ // axis mouse is now moving on
463
+ var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
464
+
465
+ // do nothing on first move
466
+ if (!this.moving) {
467
+ mouse.dirAx = newAx;
468
+ this.moving = true;
469
+ return;
470
+ }
471
+
472
+ // calc distance moved on this axis (and direction)
473
+ if (mouse.dirAx !== newAx) {
474
+ mouse.distAxX = 0;
475
+ mouse.distAxY = 0;
476
+ } else {
477
+ mouse.distAxX += Math.abs(mouse.distX);
478
+ if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
479
+ mouse.distAxX = 0;
480
+ }
481
+ mouse.distAxY += Math.abs(mouse.distY);
482
+ if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
483
+ mouse.distAxY = 0;
484
+ }
485
+ }
486
+ mouse.dirAx = newAx;
487
+
488
+ /**
489
+ * move horizontal
490
+ */
491
+ if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
492
+ // reset move distance on x-axis for new phase
493
+ mouse.distAxX = 0;
494
+ prev = this.placeEl.prev(opt.itemNodeName);
495
+ // increase horizontal level if previous sibling exists and is not collapsed
496
+ if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass) && !prev.hasClass(opt.noChildrenClass)) {
497
+ // cannot increase level when item above is collapsed
498
+ list = prev.find(opt.listNodeName).last();
499
+ // check if depth limit has reached
500
+ depth = this.placeEl.parents(opt.listNodeName).length;
501
+ if (depth + this.dragDepth <= opt.maxDepth) {
502
+ // create new sub-level if one doesn't exist
503
+ if (!list.length) {
504
+ list = $('<' + opt.listNodeName + '/>').addClass(opt.listClass);
505
+ list.append(this.placeEl);
506
+ prev.append(list);
507
+ this.setParent(prev);
508
+ } else {
509
+ // else append to next level up
510
+ list = prev.children(opt.listNodeName).last();
511
+ list.append(this.placeEl);
512
+ }
513
+ }
514
+ }
515
+ // decrease horizontal level
516
+ if (mouse.distX < 0) {
517
+ // we can't decrease a level if an item preceeds the current one
518
+ next = this.placeEl.next(opt.itemNodeName);
519
+ if (!next.length) {
520
+ parent = this.placeEl.parent();
521
+ this.placeEl.closest(opt.itemNodeName).after(this.placeEl);
522
+ if (!parent.children().length) {
523
+ this.unsetParent(parent.parent());
524
+ }
525
+ }
526
+ }
527
+ }
528
+
529
+ var isEmpty = false;
530
+
531
+ // find list item under cursor
532
+ if (!hasPointerEvents) {
533
+ this.dragEl[0].style.visibility = 'hidden';
534
+ }
535
+
536
+ this.pointEl = $(document.elementFromPoint(e.pageX - document.documentElement.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop)));
537
+
538
+ // Check if the node is dragged outside of its list.
539
+ if(this.dragRootEl.has(this.pointEl).length) {
540
+ this.isOutsideRoot = false;
541
+ this.dragEl[0].style.opacity = 1;
542
+ } else {
543
+ this.isOutsideRoot = true;
544
+ this.dragEl[0].style.opacity = 0.5;
545
+ }
546
+
547
+ // find parent list of item under cursor
548
+ var pointElRoot = this.pointEl.closest('.' + opt.rootClass),
549
+ isNewRoot = this.dragRootEl.data('nestable-id') !== pointElRoot.data('nestable-id');
550
+
551
+ this.isOutsideRoot = !pointElRoot.length;
552
+
553
+ if (!hasPointerEvents) {
554
+ this.dragEl[0].style.visibility = 'visible';
555
+ }
556
+ if (this.pointEl.hasClass(opt.handleClass)) {
557
+ this.pointEl = this.pointEl.closest( opt.itemNodeName );
558
+ }
559
+
560
+ if (opt.maxDepth == 1 && !this.pointEl.hasClass(opt.itemClass)) {
561
+ this.pointEl = this.pointEl.closest("." + opt.itemClass);
562
+ }
563
+
564
+ if (this.pointEl.hasClass(opt.emptyClass)) {
565
+ isEmpty = true;
566
+ }
567
+ else if (!this.pointEl.length || !this.pointEl.hasClass(opt.itemClass)) {
568
+ return;
569
+ }
570
+
571
+ /**
572
+ * move vertical
573
+ */
574
+ if (!mouse.dirAx || isNewRoot || isEmpty) {
575
+ // check if groups match if dragging over new root
576
+ if (isNewRoot && opt.group !== pointElRoot.data('nestable-group')) {
577
+ return;
578
+ }
579
+ // check depth limit
580
+ depth = this.dragDepth - 1 + this.pointEl.parents(opt.listNodeName).length;
581
+ if (depth > opt.maxDepth) {
582
+ return;
583
+ }
584
+ var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
585
+ parent = this.placeEl.parent();
586
+ // if empty create new list to replace empty placeholder
587
+ if (isEmpty) {
588
+ list = $(document.createElement(opt.listNodeName)).addClass(opt.listClass);
589
+ list.append(this.placeEl);
590
+ this.pointEl.replaceWith(list);
591
+ }
592
+ else if (before) {
593
+ this.pointEl.before(this.placeEl);
594
+ }
595
+ else {
596
+ this.pointEl.after(this.placeEl);
597
+ }
598
+ if (!parent.children().length) {
599
+ this.unsetParent(parent.parent());
600
+ }
601
+ if (!this.dragRootEl.find(opt.itemNodeName).length) {
602
+ this.dragRootEl.append('<div class="' + opt.emptyClass + '"/>');
603
+ }
604
+ // parent root list has changed
605
+ this.dragRootEl = pointElRoot;
606
+ if (isNewRoot) {
607
+ this.hasNewRoot = this.el[0] !== this.dragRootEl[0];
608
+ }
609
+ }
610
+ }
611
+
612
+ };
613
+
614
+ $.fn.nestable = function(params)
615
+ {
616
+ var lists = this,
617
+ retval = this;
618
+
619
+ var generateUid = function (separator) {
620
+ var delim = separator || "-";
621
+
622
+ function S4() {
623
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
624
+ }
625
+
626
+ return (S4() + S4() + delim + S4() + delim + S4() + delim + S4() + delim + S4() + S4() + S4());
627
+ };
628
+
629
+ lists.each(function()
630
+ {
631
+ var plugin = $(this).data("nestable");
632
+
633
+ if (!plugin) {
634
+ $(this).data("nestable", new Plugin(this, params));
635
+ $(this).data("nestable-id", generateUid());
636
+ } else {
637
+ if (typeof params === 'string' && typeof plugin[params] === 'function') {
638
+ retval = plugin[params]();
639
+ }
640
+ }
641
+ });
642
+
643
+ return retval || lists;
644
+ };
645
+
646
+ })(window.jQuery || window.Zepto, window, document);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_folders
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Data Curation Experts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -242,6 +242,7 @@ files:
242
242
  - lib/generators/blacklight_folders/templates/blacklight_folders_helper.rb
243
243
  - lib/migration/bookmark_migrator.rb
244
244
  - lib/tasks/blacklight_folders_tasks.rake
245
+ - vendor/assets/javascripts/jquery.nestable.js
245
246
  homepage: https://github.com/curationexperts/blacklight_folders
246
247
  licenses:
247
248
  - See LICENSE file