activeadmin_sortable_table 1.0.0
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 +7 -0
- data/.gitignore +21 -0
- data/.rspec +2 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +20 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +245 -0
- data/LICENSE.txt +22 -0
- data/README.md +97 -0
- data/Rakefile +27 -0
- data/activeadmin_sortable_table.gemspec +28 -0
- data/app/assets/javascripts/activeadmin_sortable_table.js +35 -0
- data/app/assets/stylesheets/activeadmin_sortable_table.css +11 -0
- data/lib/active_admin/sortable_table/engine.rb +9 -0
- data/lib/active_admin/sortable_table/handle_column.rb +46 -0
- data/lib/active_admin/sortable_table/version.rb +6 -0
- data/lib/activeadmin_sortable_table.rb +38 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/admin/categories.rb +12 -0
- data/spec/dummy/app/admin/dashboard.rb +32 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/active_admin.js.coffee +3 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/jquery.simulate.js +314 -0
- data/spec/dummy/app/assets/stylesheets/active_admin.scss +17 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/category.rb +3 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/active_admin.rb +262 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20150910072150_create_active_admin_comments.rb +19 -0
- data/spec/dummy/db/migrate/20150910072505_create_categories.rb +8 -0
- data/spec/dummy/db/schema.rb +36 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/features/activeadmin_sortable_table_spec.rb +31 -0
- data/spec/rails_helper.rb +62 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/support/wait_for_ajax.rb +20 -0
- metadata +288 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dd29005165c2b7b96948af430a6f920967e24404
|
4
|
+
data.tar.gz: df533c6372366c40ec3c20a90fcb6774e4b267ab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f30d2d8237e4863ebca8fe0240309ba214b1ceed98ca7cd890d92c16a9ab0d0ebd6afab0b10fce80de58d41767fd9bbd10a37ff7bd3185abb576bf8ef7350ef9
|
7
|
+
data.tar.gz: efc33ec0a49ee5f756a56c111bad9fb456cb56f293c6031850c656952e75fa8e1ba065fe6b77b496629ed3d9b48f32fff5022b57399cb3896f787471b1376da6
|
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
spec/dummy/log/*.log
|
2
|
+
spec/dummy/tmp/
|
3
|
+
spec/dummy/public/assets
|
4
|
+
spec/dummy/.sass-cache
|
5
|
+
spec/dummy/db/test.sqlite3
|
6
|
+
*.gem
|
7
|
+
*.rbc
|
8
|
+
.bundle
|
9
|
+
.config
|
10
|
+
.yardoc
|
11
|
+
InstalledFiles
|
12
|
+
_yardoc
|
13
|
+
coverage
|
14
|
+
doc/
|
15
|
+
lib/bundler/man
|
16
|
+
pkg
|
17
|
+
rdoc
|
18
|
+
spec/reports
|
19
|
+
test/tmp
|
20
|
+
test/version_tmp
|
21
|
+
tmp
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2015-09-29 11:38:23 +0300 using RuboCop version 0.34.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
Exclude:
|
11
|
+
- spec/dummy/**/*
|
12
|
+
|
13
|
+
# Configuration parameters: AllowURI, URISchemes.
|
14
|
+
Metrics/LineLength:
|
15
|
+
Max: 120
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- 2.1.5
|
6
|
+
- 2.2.2
|
7
|
+
- ruby-head
|
8
|
+
|
9
|
+
matrix:
|
10
|
+
allow_failures:
|
11
|
+
- rvm: ruby-head
|
12
|
+
fast_finish: true
|
13
|
+
|
14
|
+
before_install: gem update --remote bundler
|
15
|
+
install:
|
16
|
+
- bundle install --retry=3
|
17
|
+
script:
|
18
|
+
- bundle exec rake dummy:prepare
|
19
|
+
- bundle exec rspec
|
20
|
+
- bundle exec rubocop
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,245 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/activeadmin/activeadmin.git
|
3
|
+
revision: a5a53c3f2b8fdfd2605575b62b158318f7651f46
|
4
|
+
specs:
|
5
|
+
activeadmin (1.0.0.pre1)
|
6
|
+
arbre (~> 1.0, >= 1.0.2)
|
7
|
+
bourbon
|
8
|
+
coffee-rails
|
9
|
+
formtastic (~> 3.1)
|
10
|
+
formtastic_i18n
|
11
|
+
inherited_resources (~> 1.6)
|
12
|
+
jquery-rails
|
13
|
+
jquery-ui-rails (~> 5.0)
|
14
|
+
kaminari (~> 0.15)
|
15
|
+
rails (>= 3.2, < 5.0)
|
16
|
+
ransack (~> 1.3)
|
17
|
+
sass-rails
|
18
|
+
|
19
|
+
PATH
|
20
|
+
remote: .
|
21
|
+
specs:
|
22
|
+
activeadmin_sortable_table (1.0.0)
|
23
|
+
activeadmin (>= 1.0.0.pre1)
|
24
|
+
|
25
|
+
GEM
|
26
|
+
remote: https://rubygems.org/
|
27
|
+
specs:
|
28
|
+
actionmailer (4.2.4)
|
29
|
+
actionpack (= 4.2.4)
|
30
|
+
actionview (= 4.2.4)
|
31
|
+
activejob (= 4.2.4)
|
32
|
+
mail (~> 2.5, >= 2.5.4)
|
33
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
34
|
+
actionpack (4.2.4)
|
35
|
+
actionview (= 4.2.4)
|
36
|
+
activesupport (= 4.2.4)
|
37
|
+
rack (~> 1.6)
|
38
|
+
rack-test (~> 0.6.2)
|
39
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
40
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
41
|
+
actionview (4.2.4)
|
42
|
+
activesupport (= 4.2.4)
|
43
|
+
builder (~> 3.1)
|
44
|
+
erubis (~> 2.7.0)
|
45
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
46
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
47
|
+
activejob (4.2.4)
|
48
|
+
activesupport (= 4.2.4)
|
49
|
+
globalid (>= 0.3.0)
|
50
|
+
activemodel (4.2.4)
|
51
|
+
activesupport (= 4.2.4)
|
52
|
+
builder (~> 3.1)
|
53
|
+
activerecord (4.2.4)
|
54
|
+
activemodel (= 4.2.4)
|
55
|
+
activesupport (= 4.2.4)
|
56
|
+
arel (~> 6.0)
|
57
|
+
activesupport (4.2.4)
|
58
|
+
i18n (~> 0.7)
|
59
|
+
json (~> 1.7, >= 1.7.7)
|
60
|
+
minitest (~> 5.1)
|
61
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
62
|
+
tzinfo (~> 1.1)
|
63
|
+
acts_as_list (0.7.2)
|
64
|
+
activerecord (>= 3.0)
|
65
|
+
addressable (2.3.8)
|
66
|
+
arbre (1.0.3)
|
67
|
+
activesupport (>= 3.0.0)
|
68
|
+
arel (6.0.3)
|
69
|
+
ast (2.1.0)
|
70
|
+
astrolabe (1.3.1)
|
71
|
+
parser (~> 2.2)
|
72
|
+
bourbon (4.2.4)
|
73
|
+
sass (~> 3.4)
|
74
|
+
thor (~> 0.19)
|
75
|
+
builder (3.2.2)
|
76
|
+
capybara (2.5.0)
|
77
|
+
mime-types (>= 1.16)
|
78
|
+
nokogiri (>= 1.3.3)
|
79
|
+
rack (>= 1.0.0)
|
80
|
+
rack-test (>= 0.5.4)
|
81
|
+
xpath (~> 2.0)
|
82
|
+
cliver (0.3.2)
|
83
|
+
coffee-rails (4.1.0)
|
84
|
+
coffee-script (>= 2.2.0)
|
85
|
+
railties (>= 4.0.0, < 5.0)
|
86
|
+
coffee-script (2.4.1)
|
87
|
+
coffee-script-source
|
88
|
+
execjs
|
89
|
+
coffee-script-source (1.9.1.1)
|
90
|
+
database_cleaner (1.5.0)
|
91
|
+
diff-lcs (1.2.5)
|
92
|
+
erubis (2.7.0)
|
93
|
+
execjs (2.6.0)
|
94
|
+
formtastic (3.1.3)
|
95
|
+
actionpack (>= 3.2.13)
|
96
|
+
formtastic_i18n (0.4.1)
|
97
|
+
globalid (0.3.6)
|
98
|
+
activesupport (>= 4.1.0)
|
99
|
+
has_scope (0.6.0)
|
100
|
+
actionpack (>= 3.2, < 5)
|
101
|
+
activesupport (>= 3.2, < 5)
|
102
|
+
i18n (0.7.0)
|
103
|
+
inherited_resources (1.6.0)
|
104
|
+
actionpack (>= 3.2, < 5)
|
105
|
+
has_scope (~> 0.6.0.rc)
|
106
|
+
railties (>= 3.2, < 5)
|
107
|
+
responders
|
108
|
+
jquery-rails (4.0.5)
|
109
|
+
rails-dom-testing (~> 1.0)
|
110
|
+
railties (>= 4.2.0)
|
111
|
+
thor (>= 0.14, < 2.0)
|
112
|
+
jquery-ui-rails (5.0.5)
|
113
|
+
railties (>= 3.2.16)
|
114
|
+
json (1.8.3)
|
115
|
+
kaminari (0.16.3)
|
116
|
+
actionpack (>= 3.0.0)
|
117
|
+
activesupport (>= 3.0.0)
|
118
|
+
launchy (2.4.3)
|
119
|
+
addressable (~> 2.3)
|
120
|
+
loofah (2.0.3)
|
121
|
+
nokogiri (>= 1.5.9)
|
122
|
+
mail (2.6.3)
|
123
|
+
mime-types (>= 1.16, < 3)
|
124
|
+
mime-types (2.6.1)
|
125
|
+
mini_portile (0.6.2)
|
126
|
+
minitest (5.8.0)
|
127
|
+
multi_json (1.11.2)
|
128
|
+
nokogiri (1.6.6.2)
|
129
|
+
mini_portile (~> 0.6.0)
|
130
|
+
parser (2.2.2.6)
|
131
|
+
ast (>= 1.1, < 3.0)
|
132
|
+
phantomjs (1.9.8.0)
|
133
|
+
poltergeist (1.6.0)
|
134
|
+
capybara (~> 2.1)
|
135
|
+
cliver (~> 0.3.1)
|
136
|
+
multi_json (~> 1.0)
|
137
|
+
websocket-driver (>= 0.2.0)
|
138
|
+
polyamorous (1.2.0)
|
139
|
+
activerecord (>= 3.0)
|
140
|
+
powerpack (0.1.1)
|
141
|
+
rack (1.6.4)
|
142
|
+
rack-test (0.6.3)
|
143
|
+
rack (>= 1.0)
|
144
|
+
rails (4.2.4)
|
145
|
+
actionmailer (= 4.2.4)
|
146
|
+
actionpack (= 4.2.4)
|
147
|
+
actionview (= 4.2.4)
|
148
|
+
activejob (= 4.2.4)
|
149
|
+
activemodel (= 4.2.4)
|
150
|
+
activerecord (= 4.2.4)
|
151
|
+
activesupport (= 4.2.4)
|
152
|
+
bundler (>= 1.3.0, < 2.0)
|
153
|
+
railties (= 4.2.4)
|
154
|
+
sprockets-rails
|
155
|
+
rails-deprecated_sanitizer (1.0.3)
|
156
|
+
activesupport (>= 4.2.0.alpha)
|
157
|
+
rails-dom-testing (1.0.7)
|
158
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
159
|
+
nokogiri (~> 1.6.0)
|
160
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
161
|
+
rails-html-sanitizer (1.0.2)
|
162
|
+
loofah (~> 2.0)
|
163
|
+
railties (4.2.4)
|
164
|
+
actionpack (= 4.2.4)
|
165
|
+
activesupport (= 4.2.4)
|
166
|
+
rake (>= 0.8.7)
|
167
|
+
thor (>= 0.18.1, < 2.0)
|
168
|
+
rainbow (2.0.0)
|
169
|
+
rake (10.4.2)
|
170
|
+
ransack (1.7.0)
|
171
|
+
actionpack (>= 3.0)
|
172
|
+
activerecord (>= 3.0)
|
173
|
+
activesupport (>= 3.0)
|
174
|
+
i18n
|
175
|
+
polyamorous (~> 1.2)
|
176
|
+
responders (2.1.0)
|
177
|
+
railties (>= 4.2.0, < 5)
|
178
|
+
rspec-core (3.3.2)
|
179
|
+
rspec-support (~> 3.3.0)
|
180
|
+
rspec-expectations (3.3.1)
|
181
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
182
|
+
rspec-support (~> 3.3.0)
|
183
|
+
rspec-mocks (3.3.2)
|
184
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
185
|
+
rspec-support (~> 3.3.0)
|
186
|
+
rspec-rails (3.3.3)
|
187
|
+
actionpack (>= 3.0, < 4.3)
|
188
|
+
activesupport (>= 3.0, < 4.3)
|
189
|
+
railties (>= 3.0, < 4.3)
|
190
|
+
rspec-core (~> 3.3.0)
|
191
|
+
rspec-expectations (~> 3.3.0)
|
192
|
+
rspec-mocks (~> 3.3.0)
|
193
|
+
rspec-support (~> 3.3.0)
|
194
|
+
rspec-support (3.3.0)
|
195
|
+
rubocop (0.34.2)
|
196
|
+
astrolabe (~> 1.3)
|
197
|
+
parser (>= 2.2.2.5, < 3.0)
|
198
|
+
powerpack (~> 0.1)
|
199
|
+
rainbow (>= 1.99.1, < 3.0)
|
200
|
+
ruby-progressbar (~> 1.4)
|
201
|
+
ruby-progressbar (1.7.5)
|
202
|
+
sass (3.4.18)
|
203
|
+
sass-rails (5.0.4)
|
204
|
+
railties (>= 4.0.0, < 5.0)
|
205
|
+
sass (~> 3.1)
|
206
|
+
sprockets (>= 2.8, < 4.0)
|
207
|
+
sprockets-rails (>= 2.0, < 4.0)
|
208
|
+
tilt (>= 1.1, < 3)
|
209
|
+
sprockets (3.3.4)
|
210
|
+
rack (~> 1.0)
|
211
|
+
sprockets-rails (2.3.3)
|
212
|
+
actionpack (>= 3.0)
|
213
|
+
activesupport (>= 3.0)
|
214
|
+
sprockets (>= 2.8, < 4.0)
|
215
|
+
sqlite3 (1.3.10)
|
216
|
+
thor (0.19.1)
|
217
|
+
thread_safe (0.3.5)
|
218
|
+
tilt (2.0.1)
|
219
|
+
tzinfo (1.2.2)
|
220
|
+
thread_safe (~> 0.1)
|
221
|
+
websocket-driver (0.6.2)
|
222
|
+
websocket-extensions (>= 0.1.0)
|
223
|
+
websocket-extensions (0.1.2)
|
224
|
+
xpath (2.0.0)
|
225
|
+
nokogiri (~> 1.3)
|
226
|
+
|
227
|
+
PLATFORMS
|
228
|
+
ruby
|
229
|
+
|
230
|
+
DEPENDENCIES
|
231
|
+
activeadmin!
|
232
|
+
activeadmin_sortable_table!
|
233
|
+
acts_as_list
|
234
|
+
capybara
|
235
|
+
database_cleaner
|
236
|
+
launchy
|
237
|
+
phantomjs
|
238
|
+
poltergeist
|
239
|
+
rails (~> 4.2)
|
240
|
+
rspec-rails (~> 3.3)
|
241
|
+
rubocop
|
242
|
+
sqlite3
|
243
|
+
|
244
|
+
BUNDLED WITH
|
245
|
+
1.10.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Adam McCrea
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
[](https://travis-ci.org/bolshakov/activeadmin_sortable_table)
|
2
|
+
[](https://codeclimate.com/github/bolshakov/activeadmin_sortable_table)
|
3
|
+
|
4
|
+
# Active Admin Sortable Table
|
5
|
+
|
6
|
+
This gem extends ActiveAdmin so that your index page's table rows can be
|
7
|
+
orderable via a drag-and-drop interface.
|
8
|
+
|
9
|
+
## Prerequisites
|
10
|
+
|
11
|
+
This extension assumes that you're using one of the following on any model you want to be sortable.
|
12
|
+
|
13
|
+
#### ActiveRecord
|
14
|
+
|
15
|
+
[acts_as_list](https://github.com/swanandp/acts_as_list)
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
class Page < ActiveRecord::Base
|
19
|
+
acts_as_list
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Add it to your Gemfile
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
gem "activeadmin_sortable_table"
|
29
|
+
```
|
30
|
+
|
31
|
+
### Include the JavaScript in active_admin.js.coffee
|
32
|
+
|
33
|
+
```coffeescript
|
34
|
+
#= require activeadmin_sortable_table
|
35
|
+
```
|
36
|
+
|
37
|
+
### Include the Stylesheet in active_admin.css.scss
|
38
|
+
|
39
|
+
```scss
|
40
|
+
@import "activeadmin_sortable_table"
|
41
|
+
```
|
42
|
+
|
43
|
+
### Configure your ActiveAdmin Resource
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
ActiveAdmin.register Page do
|
47
|
+
include ActiveAdmin::SortableTable # creates the controller action which handles the sorting
|
48
|
+
config.sort_order = 'position_asc' # assumes you are using 'position' for your acts_as_list column
|
49
|
+
config.paginate = false # optional; drag-and-drop across pages is not supported
|
50
|
+
permit_params :position # do not forget to add `position` attribute to permitted prams
|
51
|
+
|
52
|
+
index do
|
53
|
+
handle_column # inserts a drag handle
|
54
|
+
# use a user-defined URL for ordering
|
55
|
+
handle_column url: :sort_admin_section_path
|
56
|
+
# alternative form with lambda
|
57
|
+
handle_column url: -> (resource) { compute_url_from_resource(resource) }
|
58
|
+
# other columns...
|
59
|
+
end
|
60
|
+
|
61
|
+
show do |c|
|
62
|
+
attributes_table do
|
63
|
+
row :id
|
64
|
+
row :name
|
65
|
+
end
|
66
|
+
|
67
|
+
panel 'Contents' do
|
68
|
+
table_for c.collection_memberships do
|
69
|
+
handle_column
|
70
|
+
column :position
|
71
|
+
column :collectable
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
### Overriding handler
|
79
|
+
|
80
|
+
You can override handler column symbol using CSS:
|
81
|
+
|
82
|
+
```css
|
83
|
+
/* active_admin.css.scss */
|
84
|
+
@import "activeadmin_sortable_table";
|
85
|
+
|
86
|
+
.activeadmin_sortable_table .handle:before {
|
87
|
+
content: '☰';
|
88
|
+
}
|
89
|
+
```
|
90
|
+
|
91
|
+
## Contributing
|
92
|
+
|
93
|
+
1. Fork it
|
94
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
95
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
96
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
97
|
+
5. Create new Pull Request
|