rails_admin_nestable 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/rails_admin_nestable/nestable.rb +5 -1
- data/lib/rails_admin_nestable/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Reorganise model data with a drag and drop tree/list structure.
|
|
8
8
|
To enable rails_admin_nestable, add the following to your `Gemfile`:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem 'rails_admin_nestable', '0.0.
|
11
|
+
gem 'rails_admin_nestable', '0.0.3'
|
12
12
|
```
|
13
13
|
|
14
14
|
Add in your `config/initializers/rails_admin.rb` initializer the configuration:
|
@@ -25,7 +25,11 @@ module RailsAdmin
|
|
25
25
|
def update_tree(tree_nodes, parent_node = nil)
|
26
26
|
tree_nodes.each do |key, value|
|
27
27
|
model = @abstract_model.model.find(value['id'])
|
28
|
-
|
28
|
+
if parent_node.present?
|
29
|
+
model.parent = parent_node
|
30
|
+
else
|
31
|
+
model.parent = nil
|
32
|
+
end
|
29
33
|
|
30
34
|
if @nestable_conf.options[:position_field].present?
|
31
35
|
model.send("#{@nestable_conf.options[:position_field]}=".to_sym, (key.to_i + 1))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_nestable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|