spina-template 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37a9dc61e724729f75310878135c2c4b50917499
|
4
|
+
data.tar.gz: 2bcc231c2f2d76fa497dfd809f5e0e1c0e8d1cbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7cb0a1d129048bd3bd09ea33178e77b2c54b7ddd22666bbd49372cafc88789e707a187123d8d99460622b03b0b06bddde68aabb9f9e1b7f92c5990936623a59
|
7
|
+
data.tar.gz: 54cec3df70ec4f67220a7ddcbea086e6de350ca47adc0d0541b24f007081354e6fb7772afa4b1fb1af31becdb2306dbf6602915b9e8eae80385cb270bdfb5839
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spina-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bram Jetten
|
@@ -153,7 +153,6 @@ files:
|
|
153
153
|
- vendor/.DS_Store
|
154
154
|
- vendor/assets/.DS_Store
|
155
155
|
- vendor/assets/javascripts/.DS_Store
|
156
|
-
- vendor/assets/javascripts/spina/html.sortable.js
|
157
156
|
- vendor/assets/javascripts/spina/jquery.customfileinput.js
|
158
157
|
- vendor/assets/javascripts/spina/jquery.datatables.js
|
159
158
|
- vendor/assets/javascripts/spina/jquery.farbtastic.js
|
@@ -1,206 +0,0 @@
|
|
1
|
-
(function(root, factory) {
|
2
|
-
if (typeof define === 'function' && define.amd) {
|
3
|
-
define(['jquery'], factory);
|
4
|
-
} else if (typeof exports === 'object') {
|
5
|
-
module.exports = factory(require('jquery'));
|
6
|
-
} else {
|
7
|
-
root.sortable = factory(root.jquery);
|
8
|
-
}
|
9
|
-
}(this, function($) {
|
10
|
-
/*
|
11
|
-
* HTML5 Sortable jQuery Plugin
|
12
|
-
* https://github.com/voidberg/html5sortable
|
13
|
-
*
|
14
|
-
* Original code copyright 2012 Ali Farhadi.
|
15
|
-
* This version is mantained by Alexandru Badiu <andu@ctrlz.ro> & Lukas Oppermann <lukas@vea.re>
|
16
|
-
*
|
17
|
-
*
|
18
|
-
* Released under the MIT license.
|
19
|
-
*/
|
20
|
-
var dragging;
|
21
|
-
var draggingHeight;
|
22
|
-
var placeholders = $();
|
23
|
-
var sortable = function(options) {
|
24
|
-
'use strict';
|
25
|
-
var method = String(options);
|
26
|
-
|
27
|
-
options = $.extend({
|
28
|
-
connectWith: false,
|
29
|
-
placeholder: null,
|
30
|
-
dragImage: null,
|
31
|
-
placeholderClass: 'sortable-placeholder',
|
32
|
-
draggingClass: 'sortable-dragging'
|
33
|
-
}, options);
|
34
|
-
|
35
|
-
return this.each(function() {
|
36
|
-
|
37
|
-
var index;
|
38
|
-
var $sortable = $(this);
|
39
|
-
var items = $sortable.children(options.items);
|
40
|
-
var handles = options.handle ? items.find(options.handle) : items;
|
41
|
-
|
42
|
-
if (method === 'reload') {
|
43
|
-
// remove event handlers from items
|
44
|
-
items.off('dragstart.h5s');
|
45
|
-
items.off('dragend.h5s');
|
46
|
-
items.off('selectstart.h5s');
|
47
|
-
items.off('dragover.h5s');
|
48
|
-
items.off('dragenter.h5s');
|
49
|
-
items.off('drop.h5s');
|
50
|
-
// remove event handlers from sortable
|
51
|
-
$sortable.off('dragover.h5s');
|
52
|
-
$sortable.off('dragenter.h5s');
|
53
|
-
$sortable.off('drop.h5s');
|
54
|
-
}
|
55
|
-
|
56
|
-
if (/^enable|disable|destroy$/.test(method)) {
|
57
|
-
var citems = $(this).children($(this).data('items'));
|
58
|
-
citems.attr('draggable', method === 'enable');
|
59
|
-
|
60
|
-
$(this).attr('aria-dropeffect', (/^disable|destroy$/.test(method) ? 'none' : 'move'));
|
61
|
-
|
62
|
-
if (method === 'destroy') {
|
63
|
-
$(this).off('sortstart sortupdate');
|
64
|
-
$(this).removeData('opts');
|
65
|
-
citems.add(this).removeData('connectWith items')
|
66
|
-
.off('dragstart.h5s dragend.h5s dragover.h5s dragenter.h5s drop.h5s sortupdate');
|
67
|
-
handles.off('selectstart.h5s');
|
68
|
-
}
|
69
|
-
return;
|
70
|
-
}
|
71
|
-
|
72
|
-
var soptions = $(this).data('opts');
|
73
|
-
|
74
|
-
if (typeof soptions === 'undefined') {
|
75
|
-
$(this).data('opts', options);
|
76
|
-
} else {
|
77
|
-
options = soptions;
|
78
|
-
}
|
79
|
-
|
80
|
-
var startParent;
|
81
|
-
var newParent;
|
82
|
-
var placeholder = (options.placeholder === null) ? $('<' + (/^ul|ol$/i.test(this.tagName) ? 'li' : 'div') + ' class="' + options.placeholderClass + '"/>') : $(options.placeholder).addClass(options.placeholderClass);
|
83
|
-
|
84
|
-
$(this).data('items', options.items);
|
85
|
-
placeholders = placeholders.add(placeholder);
|
86
|
-
if (options.connectWith) {
|
87
|
-
$(options.connectWith).add(this).data('connectWith', options.connectWith);
|
88
|
-
}
|
89
|
-
|
90
|
-
items.attr('role', 'option');
|
91
|
-
items.attr('aria-grabbed', 'false');
|
92
|
-
|
93
|
-
// Setup drag handles
|
94
|
-
handles.attr('draggable', 'true');
|
95
|
-
handles.not('a[href], img').on('selectstart.h5s', function() {
|
96
|
-
if (this.dragDrop) {
|
97
|
-
this.dragDrop();
|
98
|
-
}
|
99
|
-
}).end();
|
100
|
-
|
101
|
-
// Handle drag events on draggable items
|
102
|
-
items.on('dragstart.h5s', function(e) {
|
103
|
-
e.stopImmediatePropagation();
|
104
|
-
var dt = e.originalEvent.dataTransfer;
|
105
|
-
dt.effectAllowed = 'move';
|
106
|
-
dt.setData('text', '');
|
107
|
-
|
108
|
-
if (options.dragImage && dt.setDragImage) {
|
109
|
-
dt.setDragImage(options.dragImage, 0, 0);
|
110
|
-
}
|
111
|
-
|
112
|
-
// cache selsection & add attr for dragging
|
113
|
-
dragging = $(this);
|
114
|
-
dragging.addClass(options.draggingClass);
|
115
|
-
dragging.attr('aria-grabbed', 'true');
|
116
|
-
// grab values
|
117
|
-
index = dragging.index();
|
118
|
-
draggingHeight = dragging.height();
|
119
|
-
startParent = $(this).parent();
|
120
|
-
// trigger sortstar update
|
121
|
-
dragging.parent().triggerHandler('sortstart', {
|
122
|
-
item: dragging,
|
123
|
-
startparent: startParent
|
124
|
-
});
|
125
|
-
});
|
126
|
-
// Handle drag events on draggable items
|
127
|
-
items.on('dragend.h5s', function() {
|
128
|
-
if (!dragging) {
|
129
|
-
return;
|
130
|
-
}
|
131
|
-
// remove dragging attributes and show item
|
132
|
-
dragging.removeClass(options.draggingClass);
|
133
|
-
dragging.attr('aria-grabbed', 'false');
|
134
|
-
dragging.show();
|
135
|
-
|
136
|
-
placeholders.detach();
|
137
|
-
newParent = $(this).parent();
|
138
|
-
if (index !== dragging.index() ||
|
139
|
-
startParent.get(0) !== newParent.get(0)) {
|
140
|
-
dragging.parent().triggerHandler('sortupdate', {
|
141
|
-
item: dragging,
|
142
|
-
oldindex: index,
|
143
|
-
startparent: startParent,
|
144
|
-
endparent: newParent
|
145
|
-
});
|
146
|
-
}
|
147
|
-
dragging = null;
|
148
|
-
draggingHeight = null;
|
149
|
-
});
|
150
|
-
// Handle dragover, dragenter and drop events on draggable items
|
151
|
-
items.add([this, placeholder]).on('dragover.h5s dragenter.h5s drop.h5s', function(e) {
|
152
|
-
if (!items.is(dragging) &&
|
153
|
-
options.connectWith !== $(dragging).parent().data('connectWith')) {
|
154
|
-
return true;
|
155
|
-
}
|
156
|
-
if (e.type === 'drop') {
|
157
|
-
e.stopPropagation();
|
158
|
-
placeholders.filter(':visible').after(dragging);
|
159
|
-
dragging.trigger('dragend.h5s');
|
160
|
-
return false;
|
161
|
-
}
|
162
|
-
e.preventDefault();
|
163
|
-
e.originalEvent.dataTransfer.dropEffect = 'move';
|
164
|
-
if (items.is(this)) {
|
165
|
-
var thisHeight = $(this).height();
|
166
|
-
if (options.forcePlaceholderSize) {
|
167
|
-
placeholder.height(draggingHeight);
|
168
|
-
}
|
169
|
-
|
170
|
-
// Check if $(this) is bigger than the draggable. If it is, we have to define a dead zone to prevent flickering
|
171
|
-
if (thisHeight > draggingHeight) {
|
172
|
-
// Dead zone?
|
173
|
-
var deadZone = thisHeight - draggingHeight;
|
174
|
-
var offsetTop = $(this).offset().top;
|
175
|
-
if (placeholder.index() < $(this).index() &&
|
176
|
-
e.originalEvent.pageY < offsetTop + deadZone) {
|
177
|
-
return false;
|
178
|
-
}
|
179
|
-
if (placeholder.index() > $(this).index() &&
|
180
|
-
e.originalEvent.pageY > offsetTop + thisHeight - deadZone) {
|
181
|
-
return false;
|
182
|
-
}
|
183
|
-
}
|
184
|
-
|
185
|
-
dragging.hide();
|
186
|
-
if (placeholder.index() < $(this).index()) {
|
187
|
-
$(this).after(placeholder);
|
188
|
-
} else {
|
189
|
-
$(this).before(placeholder);
|
190
|
-
}
|
191
|
-
placeholders.not(placeholder).detach();
|
192
|
-
} else {
|
193
|
-
if (!placeholders.is(this) && !$(this).children(options.items).length) {
|
194
|
-
placeholders.detach();
|
195
|
-
$(this).append(placeholder);
|
196
|
-
}
|
197
|
-
}
|
198
|
-
return false;
|
199
|
-
});
|
200
|
-
});
|
201
|
-
};
|
202
|
-
|
203
|
-
$.fn.sortable = sortable;
|
204
|
-
|
205
|
-
return sortable;
|
206
|
-
}));
|