activeadmin-orderable 0.1.1 → 0.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: 25c9e95dfc903fcd232ac199ceb1d4db527a1439
|
4
|
+
data.tar.gz: 6be807d4f4971c34c179b08091336736e339cb1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ef17270997256799cea31fa18aecec225a116380cd46d6199ac2006de08d7b533f93cd9289c43119d8ead7ae859634b75ba27f413a5a2598a408625dbb79223
|
7
|
+
data.tar.gz: 08e99778d88548c80acf3caea96d318c1aec40e6afc5548d331d84750a83d9ba76528f7e15ae387705408d3f9ef3456ba2e9029dab64591548e96ea44cfddf19
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Active Admin Orderable
|
2
2
|
|
3
3
|
This gem extends ActiveAdmin so that your index page's table rows can be
|
4
|
-
|
4
|
+
orderable via a drag-and-drop interface.
|
5
5
|
|
6
6
|
## Prerequisites
|
7
7
|
|
@@ -55,14 +55,14 @@ ActiveAdmin.register Page do
|
|
55
55
|
config.sort_order = 'position_asc' # assumes you are using 'position' for your acts_as_list column
|
56
56
|
config.paginate = false # optional; drag-and-drop across pages is not supported
|
57
57
|
|
58
|
-
|
58
|
+
orderable # creates the controller action which handles the sorting
|
59
59
|
|
60
60
|
index do
|
61
|
-
|
62
|
-
# use a user-defined URL for
|
63
|
-
|
61
|
+
orderable_handle_column # inserts a drag handle
|
62
|
+
# use a user-defined URL for ordering
|
63
|
+
orderable_handle_column url: :sort_admin_section_path
|
64
64
|
# alternative form with lambda
|
65
|
-
|
65
|
+
orderable_handle_column url: -> (resource) { compute_url_from_resource(resource) }
|
66
66
|
# other columns...
|
67
67
|
end
|
68
68
|
|
@@ -74,7 +74,7 @@ ActiveAdmin.register Page do
|
|
74
74
|
|
75
75
|
panel 'Contents' do
|
76
76
|
table_for c.collection_memberships do
|
77
|
-
|
77
|
+
orderable_handle_column
|
78
78
|
column :position
|
79
79
|
column :collectable
|
80
80
|
end
|
@@ -5,7 +5,7 @@ require 'activeadmin-orderable/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "activeadmin-orderable"
|
8
|
-
gem.version = Activeadmin::
|
8
|
+
gem.version = Activeadmin::Orderable::VERSION
|
9
9
|
gem.authors = ["Adam McCrea", "Jonathan Gertig"]
|
10
10
|
gem.email = ["adam@adamlogic.com", "jcgertig@gmail.com"]
|
11
11
|
gem.description = %q{Drag and drop reordering interface for ActiveAdmin tables}
|
@@ -1 +1 @@
|
|
1
|
-
.activeadmin-
|
1
|
+
.activeadmin-orderable .handle { cursor: ns-resize; }
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'activeadmin-
|
1
|
+
require 'activeadmin-orderable/version'
|
2
2
|
require 'activeadmin'
|
3
3
|
require 'rails/engine'
|
4
4
|
|
5
5
|
module ActiveAdmin
|
6
|
-
module
|
6
|
+
module Orderable
|
7
7
|
module ControllerActions
|
8
|
-
def
|
8
|
+
def orderable
|
9
9
|
member_action :sort, :method => :post do
|
10
10
|
if defined?(::Mongoid::Orderable) &&
|
11
11
|
resource.class.included_modules.include?(::Mongoid::Orderable)
|
@@ -21,8 +21,8 @@ module ActiveAdmin
|
|
21
21
|
module TableMethods
|
22
22
|
HANDLE = '↕'.html_safe
|
23
23
|
|
24
|
-
def
|
25
|
-
column '', :class => "activeadmin-
|
24
|
+
def orderable_handle_column options = {}
|
25
|
+
column '', :class => "activeadmin-orderable" do |resource|
|
26
26
|
sort_url = if options[:url].is_a? Symbol
|
27
27
|
send options[:url], resource
|
28
28
|
elsif options[:url].respond_to? :call
|