activeadmin_reorderable 0.0.1 → 0.1.5
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 +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +27 -0
- data/README.md +12 -0
- data/app/assets/javascripts/activeadmin_reorderable.js +26 -20
- data/lib/active_admin/reorderable/dsl.rb +1 -1
- data/lib/active_admin/reorderable/table_methods.rb +6 -2
- data/lib/activeadmin_reorderable/version.rb +1 -1
- metadata +13 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a3444cc5455393598880575853ae90a3fa3c96ad70db05266319ca3f11175321
|
|
4
|
+
data.tar.gz: 4f61654aee46f935210df56e3ff98702538a0bd455937b57d3ad19f766d4e92b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8b5032d8e89cd76d8649656e240509296b9dd4b150c9a5ac5fa4e5c84bd1f6753ed2a400dc2cc4954b0ecaae5fd776885747f97973e1ca701a2bbc225f2d4c1
|
|
7
|
+
data.tar.gz: 9e68c6debce31865ba13d2ed203ae2317ad06cb42040b6308590ab8db4b3ea921de6b2e0e61b11448f9b869fa8b568ed2e477c98878370d14fa26a489070b515
|
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
builds/*
|
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for considering a contribution to this project!
|
|
4
|
+
|
|
5
|
+
## Deployment
|
|
6
|
+
|
|
7
|
+
`activeadmin_reorderable` is published on http://rubygems.org. The
|
|
8
|
+
following steps are necessary to push a new version:
|
|
9
|
+
|
|
10
|
+
### Build the gem
|
|
11
|
+
|
|
12
|
+
`gem build activeadmin_reorderable.gemspec`
|
|
13
|
+
|
|
14
|
+
This will produce an artifact named roughly
|
|
15
|
+
`activeadmin_reorderable-<version>.gem`.
|
|
16
|
+
|
|
17
|
+
### Publish the gem
|
|
18
|
+
|
|
19
|
+
`gem push activeadmin_reorderable-<version>.gem`
|
|
20
|
+
|
|
21
|
+
You may bump into permissions issues if you have not been added as an
|
|
22
|
+
owner on the gem. Consult the Viget development team for acess.
|
|
23
|
+
|
|
24
|
+
## Reviews
|
|
25
|
+
|
|
26
|
+
All changes should be submitted through pull request. Ideally, at
|
|
27
|
+
least two :+1:s should be given before a pull request is merge.
|
data/README.md
CHANGED
|
@@ -52,3 +52,15 @@ ActiveAdmin.register Widget do
|
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
```
|
|
55
|
+
|
|
56
|
+
## Contributing
|
|
57
|
+
|
|
58
|
+
1. Fork it ( https://github.com/[my-github-username]/activeadmin_reorderable/fork )
|
|
59
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
60
|
+
3. Commit your changes (`git commit -am "Add some feature"`)
|
|
61
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
62
|
+
5. Create a new Pull Request
|
|
63
|
+
|
|
64
|
+
### Issue and PR reviews
|
|
65
|
+
|
|
66
|
+
Another way you can help is by reviewing issues, trying to reproduce bugs, and providing feedback on PRs.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
$.fn.reorderable = function(opts) {
|
|
1
|
+
$.fn.reorderable = function (opts) {
|
|
2
2
|
// This helper fixes the table row width collapsing when being dragged
|
|
3
3
|
function reorderableTableHelper(e, ui) {
|
|
4
|
-
|
|
5
|
-
ui.children().each(function() {
|
|
4
|
+
ui.children().each(function () {
|
|
6
5
|
var $cell = $(this);
|
|
7
6
|
|
|
8
7
|
$cell.width($cell.width());
|
|
@@ -19,16 +18,17 @@ $.fn.reorderable = function(opts) {
|
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
function reorderableTableStop(e, ui) {
|
|
22
|
-
var $row
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
index = function(i) { return $rows.index(i) + 1; };
|
|
21
|
+
var $row = ui.item,
|
|
22
|
+
$rows = $row.parent().children('tr'),
|
|
23
|
+
$table = $row.closest('table'),
|
|
24
|
+
$handle = $row.find('.reorder-handle'),
|
|
25
|
+
url = $handle.data('reorder-url'),
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
index = function (i) { return $rows.index(i) + 1; };
|
|
28
|
+
|
|
29
|
+
$table.find('tbody tr').each(function (index) {
|
|
30
|
+
var $row = $(this),
|
|
31
|
+
newClass = ''
|
|
32
32
|
|
|
33
33
|
$row.removeClass('odd').removeClass('even');
|
|
34
34
|
|
|
@@ -41,27 +41,33 @@ $.fn.reorderable = function(opts) {
|
|
|
41
41
|
$row.addClass(newClass);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
$rows.each(function() {
|
|
44
|
+
$rows.each(function () {
|
|
45
45
|
$(this).find('.position').text(index($(this)));
|
|
46
46
|
});
|
|
47
|
+
var top_id = $row.prev().find('.reorder-handle').data("reorderId")
|
|
48
|
+
var bottom_id = $row.next().find('.reorder-handle').data("reorderId")
|
|
47
49
|
|
|
48
|
-
$.post(url, {
|
|
50
|
+
$.post(url, {
|
|
51
|
+
position: index($row),
|
|
52
|
+
top_id: top_id,
|
|
53
|
+
bottom_id: bottom_id
|
|
54
|
+
});
|
|
49
55
|
}
|
|
50
56
|
|
|
51
|
-
return this.each(function() {
|
|
57
|
+
return this.each(function () {
|
|
52
58
|
var opts = $.extend({
|
|
53
|
-
items:
|
|
59
|
+
items: 'tbody tr',
|
|
54
60
|
handle: '.reorder-handle',
|
|
55
|
-
axis:
|
|
61
|
+
axis: 'y',
|
|
56
62
|
helper: reorderableTableHelper,
|
|
57
|
-
start:
|
|
58
|
-
stop:
|
|
63
|
+
start: reorderableTableStart,
|
|
64
|
+
stop: reorderableTableStop,
|
|
59
65
|
}, opts || {});
|
|
60
66
|
|
|
61
67
|
$(this).sortable(opts);
|
|
62
68
|
});
|
|
63
69
|
};
|
|
64
70
|
|
|
65
|
-
$(function() {
|
|
71
|
+
$(function () {
|
|
66
72
|
$('.aa-reorderable').reorderable();
|
|
67
73
|
});
|
|
@@ -11,8 +11,12 @@ module ActiveAdmin
|
|
|
11
11
|
private
|
|
12
12
|
|
|
13
13
|
def reorder_handle_for(resource)
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
aa_resource = active_admin_namespace.resource_for(resource.class)
|
|
15
|
+
instance_name = aa_resource.resources_configuration[:self][:route_instance_name]
|
|
16
|
+
|
|
17
|
+
url = send([:reorder, aa_resource.route_prefix, instance_name, :path].join('_'), resource)
|
|
18
|
+
|
|
19
|
+
span(reorder_handle_content, :class => 'reorder-handle', 'data-reorder-url' => url, 'data-reorder-id' => resource.id)
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
def reorder_handle_content
|
metadata
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activeadmin_reorderable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Jones
|
|
8
8
|
- Lawson Kurtz
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activeadmin
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
|
-
- -
|
|
18
|
+
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
20
|
version: '0.6'
|
|
21
21
|
type: :development
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
|
-
- -
|
|
25
|
+
- - ">="
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '0.6'
|
|
28
28
|
description: Add drag and drop reordering to ActiveAdmin tables.
|
|
@@ -32,6 +32,9 @@ executables: []
|
|
|
32
32
|
extensions: []
|
|
33
33
|
extra_rdoc_files: []
|
|
34
34
|
files:
|
|
35
|
+
- ".gitignore"
|
|
36
|
+
- CHANGELOG.md
|
|
37
|
+
- CONTRIBUTING.md
|
|
35
38
|
- Gemfile
|
|
36
39
|
- MIT-LICENSE
|
|
37
40
|
- README.md
|
|
@@ -49,25 +52,23 @@ homepage: http://www.github.com/vigetlabs/activeadmin_reorderable
|
|
|
49
52
|
licenses:
|
|
50
53
|
- MIT
|
|
51
54
|
metadata: {}
|
|
52
|
-
post_install_message:
|
|
55
|
+
post_install_message:
|
|
53
56
|
rdoc_options: []
|
|
54
57
|
require_paths:
|
|
55
58
|
- lib
|
|
56
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
60
|
requirements:
|
|
58
|
-
- -
|
|
61
|
+
- - ">="
|
|
59
62
|
- !ruby/object:Gem::Version
|
|
60
63
|
version: '0'
|
|
61
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
65
|
requirements:
|
|
63
|
-
- -
|
|
66
|
+
- - ">="
|
|
64
67
|
- !ruby/object:Gem::Version
|
|
65
68
|
version: '0'
|
|
66
69
|
requirements: []
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
signing_key:
|
|
70
|
+
rubygems_version: 3.1.2
|
|
71
|
+
signing_key:
|
|
70
72
|
specification_version: 4
|
|
71
73
|
summary: Drag and drop reordering for ActiveAdmin tables
|
|
72
74
|
test_files: []
|
|
73
|
-
has_rdoc:
|