spina-template 0.2.9 → 0.2.10

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: 2f7a36300f9ef71c0beb21d72224178759710b88
4
- data.tar.gz: 4c9cea62c9091d7baefbc4d86ecca27dc67fc9c7
3
+ metadata.gz: c4bec19d8adc63fa434993e5fe35a95fa984cf5f
4
+ data.tar.gz: 09f45ff96fa58068fed1fc96e9a7bfbd0813802c
5
5
  SHA512:
6
- metadata.gz: d0f39d18df206321ce46fe36843b87a2a929777b366a56b893732dc5f69b05e032b1955954242e1ed7c400fbabbe39e57af9fe35272f45520d3f71f4a9aab1b2
7
- data.tar.gz: 67d91fb7a5b7aad687d874541239245abcd4b6e8dcfc7f49f71d76f39f3086dd5c373ba5beeaf0ebd2ae4da5ecb270137d0190a2dce3e36b571e6eda83b92d1b
6
+ metadata.gz: 88f8ff34fe3a0d33be70287cd2e5bca18ffff7b6c986583a7e1f1a83688e04ff14e154c89fb180340733dcd92d798d95046137be4309774530d3f34d3a28cd9d
7
+ data.tar.gz: a9fe4559789743ed99a8b6f59bd722ec0b9887a71548134fab1738903cace9a0e346a68c2d101d5f4d0271fe7035fcdce6d5b3031d5c8de4c029526e418e5475
@@ -1,10 +1,10 @@
1
1
  #= require spina/jquery.datatables
2
2
  #= require spina/jquery.ui
3
3
  #= require spina/jquery.ui.datepicker-nl
4
- #= require spina/jquery.sortable
5
4
  #= require spina/jquery.nestable
6
5
  #= require spina/jquery.customfileinput
7
6
  #= require spina/jquery.farbtastic
7
+ #= require spina/html.sortable
8
8
  #= require jquery-fileupload/basic
9
9
  #= require spina/raphael
10
10
  #= require spina/morris
@@ -1,5 +1,5 @@
1
1
  module Spina
2
2
  module Template
3
- VERSION = "0.2.9"
3
+ VERSION = "0.2.10"
4
4
  end
5
5
  end
@@ -0,0 +1,206 @@
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
+ }));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spina-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bram Jetten
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-21 00:00:00.000000000 Z
11
+ date: 2015-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -153,11 +153,11 @@ 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
156
157
  - vendor/assets/javascripts/spina/jquery.customfileinput.js
157
158
  - vendor/assets/javascripts/spina/jquery.datatables.js
158
159
  - vendor/assets/javascripts/spina/jquery.farbtastic.js
159
160
  - vendor/assets/javascripts/spina/jquery.nestable.js
160
- - vendor/assets/javascripts/spina/jquery.sortable.js
161
161
  - vendor/assets/javascripts/spina/jquery.ui.datepicker-nl.js
162
162
  - vendor/assets/javascripts/spina/jquery.ui.js
163
163
  - vendor/assets/javascripts/spina/morris.js
@@ -1,2 +0,0 @@
1
- !function(t){"use strict";var e,r,a=t();t.fn.sortable=function(s){var i=String(s);return s=t.extend({connectWith:!1,placeholder:null,dragImage:null},s),this.each(function(){var n,d=t(this).children(s.items),o=s.handle?d.find(s.handle):d;if("reload"===i&&(t(this).children(s.items).off("dragstart.h5s dragend.h5s selectstart.h5s dragover.h5s dragenter.h5s drop.h5s"),t(this).off("dragover.h5s dragenter.h5s drop.h5s")),/^enable|disable|destroy$/.test(i)){var h=t(this).children(t(this).data("items")).attr("draggable","enable"===i);return t(this).attr("aria-dropeffect",/^disable|destroy$/.test(i)?"none":"move"),void("destroy"===i&&(t(this).off("sortstart sortupdate"),t(this).removeData("opts"),h.add(this).removeData("connectWith items").off("dragstart.h5s dragend.h5s dragover.h5s dragenter.h5s drop.h5s").off("sortupdate"),o.off("selectstart.h5s")))}var l=t(this).data("opts");"undefined"==typeof l?t(this).data("opts",s):s=l;var g,f,c=null===s.placeholder?t("<"+(/^ul|ol$/i.test(this.tagName)?"li":"div")+' class="sortable-placeholder"/>'):t(s.placeholder).addClass("sortable-placeholder");t(this).data("items",s.items),a=a.add(c),s.connectWith&&t(s.connectWith).add(this).data("connectWith",s.connectWith),d.attr("role","option"),d.attr("aria-grabbed","false"),o.attr("draggable","true").not("a[href], img").on("selectstart.h5s",function(){return this.dragDrop&&this.dragDrop(),!1}).end(),d.on("dragstart.h5s",function(a){a.stopImmediatePropagation();var i=a.originalEvent.dataTransfer;i.effectAllowed="move",i.setData("text",""),s.dragImage&&i.setDragImage&&i.setDragImage(s.dragImage,0,0),n=(e=t(this)).addClass("sortable-dragging").attr("aria-grabbed","true").index(),r=e.outerHeight(),g=t(this).parent(),e.parent().triggerHandler("sortstart",{item:e,startparent:g})}).on("dragend.h5s",function(){e&&(e.removeClass("sortable-dragging").attr("aria-grabbed","false").show(),a.detach(),f=t(this).parent(),(n!==e.index()||g.get(0)!==f.get(0))&&e.parent().triggerHandler("sortupdate",{item:e,oldindex:n,startparent:g,endparent:f}),e=null,r=null)}).add([this,c]).on("dragover.h5s dragenter.h5s drop.h5s",function(i){if(!d.is(e)&&s.connectWith!==t(e).parent().data("connectWith"))return!0;if("drop"===i.type)return i.stopPropagation(),a.filter(":visible").after(e),e.trigger("dragend.h5s"),!1;if(i.preventDefault(),i.originalEvent.dataTransfer.dropEffect="move",d.is(this)){var n=t(this).outerHeight();if(s.forcePlaceholderSize&&c.height(r),n>r){var o=n-r,h=t(this).offset().top;if(c.index()<t(this).index()&&i.originalEvent.pageY<h+o)return!1;if(c.index()>t(this).index()&&i.originalEvent.pageY>h+n-o)return!1}e.hide(),t(this)[c.index()<t(this).index()?"after":"before"](c),a.not(c).detach()}else a.is(this)||t(this).children(s.items).length||(a.detach(),t(this).append(c));return!1})})}}(jQuery);
2
- //# sourceMappingURL=html.sortable.min.js.map