active_admin-awesome_nested_set 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module ActiveAdmin
|
3
|
+
module Views
|
4
|
+
|
5
|
+
# = Index as a Nested Set
|
6
|
+
#
|
7
|
+
# Shows index page as a tree
|
8
|
+
#
|
9
|
+
# index :as => :nested_set do |product|
|
10
|
+
# Another options for table
|
11
|
+
# link_to(image_tag(product.image_path), admin_products_path(product))
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
class IndexAsNestedSet < IndexAsTable
|
15
|
+
|
16
|
+
def build(page_presenter, collection)
|
17
|
+
super page_presenter, get_nested_set( resource_class )
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def get_nested_set class_or_item
|
23
|
+
result = []
|
24
|
+
|
25
|
+
roots = class_or_item.respond_to?(:scoped) ? class_or_item.roots : class_or_items
|
26
|
+
|
27
|
+
items = roots.each do |root|
|
28
|
+
result += root.self_and_descendants.compact
|
29
|
+
end
|
30
|
+
|
31
|
+
result
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'active_admin/awesome_nested_set/engine'
|
2
2
|
require 'active_admin/awesome_nested_set/version'
|
3
3
|
require 'active_admin/awesome_nested_set/helper'
|
4
|
+
require 'active_admin/views/index_as_nested_set'
|
4
5
|
|
5
6
|
module ActiveAdminActsAsList
|
6
7
|
end
|
8
|
+
|
9
|
+
ActiveAdmin::ResourceDSL.send :include, ActiveAdmin::AwesomeNestedSet::Helper
|
10
|
+
ActiveAdmin::Views::IndexAsTable.send :include, ActiveAdmin::AwesomeNestedSet::Helper
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_admin-awesome_nested_set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Roberto Vasquez Angel
|
@@ -10,7 +15,7 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2012-
|
18
|
+
date: 2012-08-08 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rails
|
@@ -20,6 +25,11 @@ dependencies:
|
|
20
25
|
requirements:
|
21
26
|
- - ~>
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 5
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 2
|
32
|
+
- 5
|
23
33
|
version: 3.2.5
|
24
34
|
type: :runtime
|
25
35
|
version_requirements: *id001
|
@@ -31,6 +41,9 @@ dependencies:
|
|
31
41
|
requirements:
|
32
42
|
- - ">="
|
33
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
34
47
|
version: "0"
|
35
48
|
type: :development
|
36
49
|
version_requirements: *id002
|
@@ -42,6 +55,9 @@ dependencies:
|
|
42
55
|
requirements:
|
43
56
|
- - ">="
|
44
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
45
61
|
version: "0"
|
46
62
|
type: :development
|
47
63
|
version_requirements: *id003
|
@@ -53,6 +69,9 @@ dependencies:
|
|
53
69
|
requirements:
|
54
70
|
- - ">="
|
55
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
56
75
|
version: "0"
|
57
76
|
type: :development
|
58
77
|
version_requirements: *id004
|
@@ -67,6 +86,7 @@ extra_rdoc_files: []
|
|
67
86
|
|
68
87
|
files:
|
69
88
|
- config/locales/active_admin-awesome_nested_set.de.yml
|
89
|
+
- lib/active_admin/views/index_as_nested_set.rb
|
70
90
|
- lib/active_admin/awesome_nested_set/helper.rb
|
71
91
|
- lib/active_admin/awesome_nested_set/engine.rb
|
72
92
|
- lib/active_admin/awesome_nested_set/version.rb
|
@@ -119,12 +139,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
139
|
requirements:
|
120
140
|
- - ">="
|
121
141
|
- !ruby/object:Gem::Version
|
142
|
+
hash: 3
|
143
|
+
segments:
|
144
|
+
- 0
|
122
145
|
version: "0"
|
123
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
147
|
none: false
|
125
148
|
requirements:
|
126
149
|
- - ">="
|
127
150
|
- !ruby/object:Gem::Version
|
151
|
+
hash: 3
|
152
|
+
segments:
|
153
|
+
- 0
|
128
154
|
version: "0"
|
129
155
|
requirements: []
|
130
156
|
|