active_admin-acts_as_list 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +24 -5
- data/lib/active_admin/acts_as_list/helper.rb +31 -0
- data/lib/active_admin/acts_as_list/version.rb +1 -1
- metadata +26 -3
data/README.rdoc
CHANGED
@@ -1,18 +1,28 @@
|
|
1
1
|
= ActiveAdminActsAsList
|
2
2
|
|
3
|
-
|
3
|
+
= Purpose
|
4
|
+
|
5
|
+
Add sortable columns for active admin.
|
6
|
+
|
7
|
+
= Features
|
8
|
+
|
9
|
+
* Add member actions with one method call
|
10
|
+
* Add sorting columns in your index views with one method call.
|
11
|
+
* Integrates with acts_as_list
|
4
12
|
|
5
13
|
= Prerequisites
|
6
14
|
|
7
15
|
You need active_admin and acts_as_list.
|
8
16
|
|
17
|
+
= Installation
|
9
18
|
|
10
|
-
|
19
|
+
Add it to your gemfile:
|
11
20
|
|
12
|
-
|
13
|
-
|
14
|
-
|
21
|
+
gem 'active_admin-acts_as_list'
|
22
|
+
|
23
|
+
Install your bundle:
|
15
24
|
|
25
|
+
> bundle install
|
16
26
|
|
17
27
|
= Usage
|
18
28
|
|
@@ -47,3 +57,12 @@ You can add sortable columns, member actions and sorting like this:
|
|
47
57
|
default_actions
|
48
58
|
end
|
49
59
|
end
|
60
|
+
|
61
|
+
= Todo
|
62
|
+
|
63
|
+
* Tests, tests, tests.
|
64
|
+
* Better docs.
|
65
|
+
|
66
|
+
= License
|
67
|
+
|
68
|
+
This project rocks and uses MIT-LICENSE.
|
@@ -1,6 +1,22 @@
|
|
1
1
|
module ActiveAdmin
|
2
2
|
module ActsAsList
|
3
3
|
module Helper
|
4
|
+
# Call this inside your index do...end bock to make your resource sortable.
|
5
|
+
#
|
6
|
+
# Example:
|
7
|
+
#
|
8
|
+
# #app/admin/players.rb
|
9
|
+
#
|
10
|
+
# ActiveAdmin.register Player do
|
11
|
+
# index do
|
12
|
+
# # This adds columns for moving up, down, top and bottom.
|
13
|
+
# sortable_columns
|
14
|
+
# #...
|
15
|
+
# column :firstname
|
16
|
+
# column :lastname
|
17
|
+
# default_actions
|
18
|
+
# end
|
19
|
+
# end
|
4
20
|
def sortable_columns
|
5
21
|
column "▲▲".html_safe do |resource|
|
6
22
|
link_to("▲▲".html_safe, self.send(:"move_to_top_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.first?
|
@@ -16,6 +32,21 @@ module ActiveAdmin
|
|
16
32
|
end
|
17
33
|
end
|
18
34
|
|
35
|
+
|
36
|
+
# Call this inside your resource definition to add the needed member actions
|
37
|
+
# for your sortable resource.
|
38
|
+
#
|
39
|
+
# Example:
|
40
|
+
#
|
41
|
+
# #app/admin/players.rb
|
42
|
+
#
|
43
|
+
# ActiveAdmin.register Player do
|
44
|
+
# # Sort players by position
|
45
|
+
# config.sort_order = 'position'
|
46
|
+
#
|
47
|
+
# # Add member actions for positioning.
|
48
|
+
# sortable_member_actions
|
49
|
+
# end
|
19
50
|
def sortable_member_actions
|
20
51
|
member_action :move_to_top do
|
21
52
|
if resource.first?
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: active_admin-acts_as_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Roberto Vasquez Angel
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-06-
|
13
|
+
date: 2012-06-23 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -34,6 +34,28 @@ dependencies:
|
|
34
34
|
version: "0"
|
35
35
|
type: :development
|
36
36
|
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: yard
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: thin
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id004
|
37
59
|
description: Provides sortable_columns helper in active admin resource definitions.
|
38
60
|
email:
|
39
61
|
- roberto@vasquez-angel.de
|
@@ -84,7 +106,7 @@ files:
|
|
84
106
|
- test/dummy/log/development.log
|
85
107
|
- test/dummy/script/rails
|
86
108
|
- test/active_admin-acts_as_list_test.rb
|
87
|
-
homepage:
|
109
|
+
homepage: https://github.com/robotex82/active_admin-acts_as_list
|
88
110
|
licenses: []
|
89
111
|
|
90
112
|
post_install_message:
|
@@ -143,3 +165,4 @@ test_files:
|
|
143
165
|
- test/dummy/log/development.log
|
144
166
|
- test/dummy/script/rails
|
145
167
|
- test/active_admin-acts_as_list_test.rb
|
168
|
+
has_rdoc:
|