rails_bootstrap_sortable 1.11.1 → 1.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +69 -0
- data/lib/rails_bootstrap_sortable/version.rb +1 -1
- data/vendor/assets/javascripts/bootstrap-sortable.js +26 -13
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efac0d3b6bad0b1dff278613be5a8aab39c66607
|
4
|
+
data.tar.gz: 27edb2e5dc1157c6cba2055d52438c0cb72c6efd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27342cf52a2334d61955cfb09e0c4b644bdb29213f43e05e9324f6825a367d5df8bf9c59fa1fc4929c9bd88642f772fe57c02ca8d698efca58c407cd5799a2cc
|
7
|
+
data.tar.gz: 3b784a1efb9c42d8e7654104e1db5743af6873d617646b563aa4b480d200ba2ac81050b50f50e29456d59658be05752f06a7d652cd6b8c1d34cd770f9da26f04
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rails_bootstrap_sortable (1.11.2)
|
5
|
+
momentjs-rails (~> 2, >= 2.8.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (4.2.1)
|
11
|
+
actionview (= 4.2.1)
|
12
|
+
activesupport (= 4.2.1)
|
13
|
+
rack (~> 1.6)
|
14
|
+
rack-test (~> 0.6.2)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
17
|
+
actionview (4.2.1)
|
18
|
+
activesupport (= 4.2.1)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubis (~> 2.7.0)
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
23
|
+
activesupport (4.2.1)
|
24
|
+
i18n (~> 0.7)
|
25
|
+
json (~> 1.7, >= 1.7.7)
|
26
|
+
minitest (~> 5.1)
|
27
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
28
|
+
tzinfo (~> 1.1)
|
29
|
+
builder (3.2.2)
|
30
|
+
erubis (2.7.0)
|
31
|
+
i18n (0.7.0)
|
32
|
+
json (1.8.2)
|
33
|
+
loofah (2.0.2)
|
34
|
+
nokogiri (>= 1.5.9)
|
35
|
+
mini_portile (0.6.2)
|
36
|
+
minitest (5.6.1)
|
37
|
+
momentjs-rails (2.10.2)
|
38
|
+
railties (>= 3.1)
|
39
|
+
nokogiri (1.6.6.2)
|
40
|
+
mini_portile (~> 0.6.0)
|
41
|
+
rack (1.6.1)
|
42
|
+
rack-test (0.6.3)
|
43
|
+
rack (>= 1.0)
|
44
|
+
rails-deprecated_sanitizer (1.0.3)
|
45
|
+
activesupport (>= 4.2.0.alpha)
|
46
|
+
rails-dom-testing (1.0.6)
|
47
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
48
|
+
nokogiri (~> 1.6.0)
|
49
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
50
|
+
rails-html-sanitizer (1.0.2)
|
51
|
+
loofah (~> 2.0)
|
52
|
+
railties (4.2.1)
|
53
|
+
actionpack (= 4.2.1)
|
54
|
+
activesupport (= 4.2.1)
|
55
|
+
rake (>= 0.8.7)
|
56
|
+
thor (>= 0.18.1, < 2.0)
|
57
|
+
rake (10.4.2)
|
58
|
+
thor (0.19.1)
|
59
|
+
thread_safe (0.3.5)
|
60
|
+
tzinfo (1.2.2)
|
61
|
+
thread_safe (~> 0.1)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
bundler (~> 1.6)
|
68
|
+
rails_bootstrap_sortable!
|
69
|
+
rake
|
@@ -1,10 +1,13 @@
|
|
1
|
-
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
1
|
+
/**
|
2
|
+
* TinySort is a small script that sorts HTML elements. It sorts by text- or attribute value, or by that of one of it's children.
|
3
|
+
* @summary A nodeElement sorting script.
|
4
|
+
* @version 2.2.0
|
5
|
+
* @license MIT/GPL
|
6
|
+
* @author Ron Valstar <ron@ronvalstar.nl>
|
7
|
+
* @copyright Ron Valstar <ron@ronvalstar.nl>
|
8
|
+
* @namespace tinysort
|
6
9
|
*/
|
7
|
-
!function (a, b) { "use strict"; function c() { return b } "function" == typeof define && define.amd ? define("tinysort", c) : a.tinysort = b }(this, function () { "use strict"; function a(a) { function
|
10
|
+
!function (a, b) { "use strict"; function c() { return b } "function" == typeof define && define.amd ? define("tinysort", c) : a.tinysort = b }(this, function () { "use strict"; function a(a, f) { function j() { 0 === arguments.length ? s({}) : d(arguments, function (a) { s(c(a) ? { selector: a } : a) }), p = D.length } function s(a) { var b = !!a.selector, c = b && ":" === a.selector[0], d = e(a || {}, r); D.push(e({ hasSelector: b, hasAttr: !(d.attr === i || "" === d.attr), hasData: d.data !== i, hasFilter: c, sortReturnNumber: "asc" === d.order ? 1 : -1 }, d)) } function t() { d(a, function (a, b) { y ? y !== a.parentNode && (E = !1) : y = a.parentNode; var c = D[0], d = c.hasFilter, e = c.selector, f = !e || d && a.matchesSelector(e) || e && a.querySelector(e), g = f ? B : C, h = { elm: a, pos: b, posn: g.length }; A.push(h), g.push(h) }), x = B.slice(0) } function u() { B.sort(v) } function v(a, e) { var f = 0; for (0 !== q && (q = 0) ; 0 === f && p > q;) { var i = D[q], j = i.ignoreDashes ? n : m; if (d(o, function (a) { var b = a.prepare; b && b(i) }), i.sortFunction) f = i.sortFunction(a, e); else if ("rand" == i.order) f = Math.random() < .5 ? 1 : -1; else { var k = h, r = b(a, i), s = b(e, i), t = "" === r || r === g, u = "" === s || s === g; if (r === s) f = 0; else if (i.emptyEnd && (t || u)) f = t && u ? 0 : t ? 1 : -1; else { if (!i.forceStrings) { var v = c(r) ? r && r.match(j) : h, w = c(s) ? s && s.match(j) : h; if (v && w) { var x = r.substr(0, r.length - v[0].length), y = s.substr(0, s.length - w[0].length); x == y && (k = !h, r = l(v[0]), s = l(w[0])) } } f = r === g || s === g ? 0 : s > r ? -1 : r > s ? 1 : 0 } } d(o, function (a) { var b = a.sort; b && (f = b(i, k, r, s, f)) }), f *= i.sortReturnNumber, 0 === f && q++ } return 0 === f && (f = a.pos > e.pos ? 1 : -1), f } function w() { var a = B.length === A.length; E && a ? F ? B.forEach(function (a, b) { a.elm.style.order = b }) : (B.forEach(function (a) { z.appendChild(a.elm) }), y.appendChild(z)) : (B.forEach(function (a) { var b = a.elm, c = k.createElement("div"); a.ghost = c, b.parentNode.insertBefore(c, b) }), B.forEach(function (a, b) { var c = x[b].ghost; c.parentNode.insertBefore(a.elm, c), c.parentNode.removeChild(c) })) } c(a) && (a = k.querySelectorAll(a)), 0 === a.length && console.warn("No elements to sort"); var x, y, z = k.createDocumentFragment(), A = [], B = [], C = [], D = [], E = !0, F = a.length && (f === g || f.useFlex !== !1) && -1 !== getComputedStyle(a[0].parentNode, null).display.indexOf("flex"); return j.apply(i, Array.prototype.slice.call(arguments, 1)), t(), u(), w(), B.map(function (a) { return a.elm }) } function b(a, b) { var d, e = a.elm; return b.selector && (b.hasFilter ? e.matchesSelector(b.selector) || (e = i) : e = e.querySelector(b.selector)), b.hasAttr ? d = e.getAttribute(b.attr) : b.useVal ? d = e.value || e.getAttribute("value") : b.hasData ? d = e.getAttribute("data-" + b.data) : e && (d = e.textContent), c(d) && (b.cases || (d = d.toLowerCase()), d = d.replace(/\s+/g, " ")), d } function c(a) { return "string" == typeof a } function d(a, b) { for (var c, d = a.length, e = d; e--;) c = d - e - 1, b(a[c], c) } function e(a, b, c) { for (var d in b) (c || a[d] === g) && (a[d] = b[d]); return a } function f(a, b, c) { o.push({ prepare: a, sort: b, sortBy: c }) } var g, h = !1, i = null, j = window, k = j.document, l = parseFloat, m = /(-?\d+\.?\d*)\s*$/g, n = /(\d+\.?\d*)\s*$/g, o = [], p = 0, q = 0, r = { selector: i, order: "asc", attr: i, data: i, useVal: h, place: "start", returns: h, cases: h, forceStrings: h, ignoreDashes: h, sortFunction: i, useFlex: h, emptyEnd: h }; return j.Element && function (a) { a.matchesSelector = a.matchesSelector || a.mozMatchesSelector || a.msMatchesSelector || a.oMatchesSelector || a.webkitMatchesSelector || function (a) { for (var b = this, c = (b.parentNode || b.document).querySelectorAll(a), d = -1; c[++d] && c[d] != b;); return !!c[d] } }(Element.prototype), e(f, { loop: d }), e(a, { plugin: f, defaults: r }) }());
|
8
11
|
|
9
12
|
(function ($) {
|
10
13
|
|
@@ -27,9 +30,7 @@
|
|
27
30
|
|
28
31
|
// Set attributes needed for sorting
|
29
32
|
$('table.sortable').each(function () {
|
30
|
-
var $this = $(this)
|
31
|
-
context = lookupSortContext($this),
|
32
|
-
bsSort = context.bsSort;
|
33
|
+
var $this = $(this);
|
33
34
|
applyLast = (applyLast === true);
|
34
35
|
$this.find('span.sign').remove();
|
35
36
|
|
@@ -76,6 +77,10 @@
|
|
76
77
|
$this.attr('data-value') === undefined && $this.attr('data-value', $this.text());
|
77
78
|
}
|
78
79
|
});
|
80
|
+
|
81
|
+
var context = lookupSortContext($this),
|
82
|
+
bsSort = context.bsSort;
|
83
|
+
|
79
84
|
$this.find('thead th[data-defaultsort!="disabled"]').each(function (index) {
|
80
85
|
var $this = $(this);
|
81
86
|
var $sortTable = $this.closest('table.sortable');
|
@@ -104,8 +109,16 @@
|
|
104
109
|
// This allows multiple tables on one page without collisions.
|
105
110
|
function lookupSortContext($table) {
|
106
111
|
var context = $table.data("bootstrap-sortable-context");
|
107
|
-
if (context
|
108
|
-
context = { bsSort: [], lastSort:
|
112
|
+
if (context === undefined) {
|
113
|
+
context = { bsSort: [], lastSort: undefined };
|
114
|
+
$table.find('thead th[data-defaultsort!="disabled"]').each(function (index) {
|
115
|
+
var $this = $(this);
|
116
|
+
var sortKey = $this.attr('data-sortkey');
|
117
|
+
context.bsSort[sortKey] = $this.attr('data-defaultsort');
|
118
|
+
if (context.bsSort[sortKey] !== undefined) {
|
119
|
+
context.lastSort = sortKey;
|
120
|
+
}
|
121
|
+
});
|
109
122
|
$table.data("bootstrap-sortable-context", context);
|
110
123
|
}
|
111
124
|
return context;
|
@@ -123,7 +136,7 @@
|
|
123
136
|
|
124
137
|
var colspan = $this.attr('colspan');
|
125
138
|
if (colspan) {
|
126
|
-
var mainSort =
|
139
|
+
var mainSort = parseFloat($this.data('mainsort')) || 0;
|
127
140
|
var rowIndex = parseFloat($this.data('sortkey').split('-').pop());
|
128
141
|
|
129
142
|
// If there is one more row in header, delve deeper
|
@@ -193,4 +206,4 @@
|
|
193
206
|
// Initialise on DOM ready
|
194
207
|
$($.bootstrapSortable);
|
195
208
|
|
196
|
-
}(jQuery));
|
209
|
+
}(jQuery));
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_bootstrap_sortable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamKelly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,6 +67,7 @@ extra_rdoc_files: []
|
|
67
67
|
files:
|
68
68
|
- ".gitignore"
|
69
69
|
- Gemfile
|
70
|
+
- Gemfile.lock
|
70
71
|
- LICENSE.md
|
71
72
|
- README.md
|
72
73
|
- Rakefile
|