activeadmin_sortable_table 1.1.1 → 1.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eee1f5a8aea16d3c1e840ab58b4d5e357503ae0
|
4
|
+
data.tar.gz: 20b55c4342234b9afeb1e3808c93d3a96768bc76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 861ada336d936e7d31d4733d9563cdf0954fd0cbb2ab31273f74aafb6579ecda25a13e780cef0a2311be0542d1e4a4a51499b7581aace52fd5587a0f6ab47369
|
7
|
+
data.tar.gz: 087823ddf085e64d6f1dc4fa35c21e2062ad9e59c369f9a2705454f8fe631c31e9564232735e505005525fbc25039ad064643176ad7660dc608a0b4742be8f38
|
data/CHANGELOG.md
ADDED
@@ -19,14 +19,11 @@
|
|
19
19
|
url: url,
|
20
20
|
type: 'post',
|
21
21
|
data: $.extend(customParams, { position: ui.item.find('[data-position]').data('position') - 1 }),
|
22
|
-
error: function() { console.error('Saving sortable error'); },
|
23
|
-
success: function() {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
$("tr", $('.handle').closest('tbody')).filter(":even").addClass('odd');
|
28
|
-
$("tr", $('.handle').closest('tbody')).filter(":odd").addClass('even');
|
29
|
-
}
|
22
|
+
error: function () { console.error('Saving sortable error'); },
|
23
|
+
success: function () {
|
24
|
+
location.href = location.href;
|
25
|
+
},
|
26
|
+
async: false
|
30
27
|
});
|
31
28
|
}
|
32
29
|
});
|
@@ -16,10 +16,12 @@ RSpec.describe ActiveAdmin::SortableTable, 'Drag-and-Drop', type: :feature do
|
|
16
16
|
visit admin_categories_path
|
17
17
|
|
18
18
|
expect(visible_elements).to eq([1, 2, 3])
|
19
|
+
expect(visible_positions).to eq([1, 2, 3])
|
19
20
|
|
20
21
|
move_higher(2, by_handle: true)
|
21
22
|
|
22
23
|
expect(visible_elements).to eq([2, 1, 3])
|
24
|
+
expect(visible_positions).to eq([1, 2, 3])
|
23
25
|
expect(ordered_elements).to eq([2, 1, 3])
|
24
26
|
end
|
25
27
|
|
@@ -29,10 +31,12 @@ RSpec.describe ActiveAdmin::SortableTable, 'Drag-and-Drop', type: :feature do
|
|
29
31
|
visit admin_categories_path
|
30
32
|
|
31
33
|
expect(visible_elements).to eq([1, 2, 3])
|
34
|
+
expect(visible_positions).to eq([1, 2, 3])
|
32
35
|
|
33
36
|
move_higher(2, by_handle: false)
|
34
37
|
|
35
38
|
expect(visible_elements).to eq([1, 2, 3])
|
39
|
+
expect(visible_positions).to eq([1, 2, 3])
|
36
40
|
expect(ordered_elements).to eq([1, 2, 3])
|
37
41
|
end
|
38
42
|
end
|
@@ -50,10 +54,12 @@ RSpec.describe ActiveAdmin::SortableTable, 'Drag-and-Drop', type: :feature do
|
|
50
54
|
visit admin_categories_path(page: 2)
|
51
55
|
|
52
56
|
expect(visible_elements).to eq([4, 5, 6])
|
57
|
+
expect(visible_positions).to eq([4, 5, 6])
|
53
58
|
|
54
59
|
move_higher(5, by_handle: true)
|
55
60
|
|
56
61
|
expect(visible_elements).to eq([5, 4, 6])
|
62
|
+
expect(visible_positions).to eq([4, 5, 6])
|
57
63
|
expect(ordered_elements).to eq([1, 2, 3, 5, 4, 6])
|
58
64
|
end
|
59
65
|
|
@@ -63,10 +69,12 @@ RSpec.describe ActiveAdmin::SortableTable, 'Drag-and-Drop', type: :feature do
|
|
63
69
|
visit admin_categories_path(page: 2)
|
64
70
|
|
65
71
|
expect(visible_elements).to eq([4, 5, 6])
|
72
|
+
expect(visible_positions).to eq([4, 5, 6])
|
66
73
|
|
67
74
|
move_higher(5, by_handle: false)
|
68
75
|
|
69
76
|
expect(visible_elements).to eq([4, 5, 6])
|
77
|
+
expect(visible_positions).to eq([4, 5, 6])
|
70
78
|
expect(ordered_elements).to eq([1, 2, 3, 4, 5, 6])
|
71
79
|
end
|
72
80
|
end
|
@@ -77,18 +85,18 @@ RSpec.describe ActiveAdmin::SortableTable, 'Drag-and-Drop', type: :feature do
|
|
77
85
|
all('.ui-sortable .col-id').map(&:text).map(&:to_i)
|
78
86
|
end
|
79
87
|
|
88
|
+
def visible_positions
|
89
|
+
all('.ui-sortable .col-position').map(&:text).map(&:to_i)
|
90
|
+
end
|
91
|
+
|
80
92
|
def move_higher(element_id, by_handle:)
|
81
93
|
drag_element(element_id, by_handle, dy: -200)
|
82
94
|
end
|
83
95
|
|
84
96
|
def drag_element(element_id, by_handle, options)
|
85
97
|
options.reverse_merge! moves: 20
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
90
|
-
else
|
91
|
-
page.execute_script(%($("#category_#{element_id}").simulate("drag", #{options.to_json})))
|
92
|
-
end
|
98
|
+
selector = by_handle ? "#category_#{element_id} .handle" : "#category_#{element_id}"
|
99
|
+
page.execute_script(%($("#{selector}").simulate("drag", #{options.to_json})))
|
100
|
+
sleep 0.1
|
93
101
|
end
|
94
102
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_sortable_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam McCrea
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-10-
|
13
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activeadmin
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- ".rspec"
|
152
152
|
- ".rubocop.yml"
|
153
153
|
- ".travis.yml"
|
154
|
+
- CHANGELOG.md
|
154
155
|
- Gemfile
|
155
156
|
- Gemfile.lock
|
156
157
|
- LICENSE.txt
|