rails_admin_nestable 0.0.1 → 0.0.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.
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", git: "git://github.com/dalpo/rails_admin_nestable.git"
11
+ gem 'rails_admin_nestable', '0.0.2'
12
12
  ```
13
13
 
14
14
  Add in your `config/initializers/rails_admin.rb` initializer the configuration:
@@ -33,7 +33,7 @@ RailsAdmin.config do |config|
33
33
  # Add the nestable action for each model
34
34
  nestable do
35
35
  visible do
36
- [NavNode, Product].include? bindings[:abstract_model].model
36
+ %w(NavNode Product).include? bindings[:abstract_model].model_name
37
37
  end
38
38
  end
39
39
  end
@@ -59,7 +59,10 @@ RailsAdmin.config do |config|
59
59
  end
60
60
 
61
61
  config.model MyModel do
62
- nestable_tree({ position_field: :position, max_depth: 3 })
62
+ nestable_tree({
63
+ position_field: :position,
64
+ max_depth: 3
65
+ })
63
66
  end
64
67
  end
65
68
  ```
@@ -1,35 +1,3 @@
1
- :ruby
2
- def nested_tree_nodes(tree_nodes = [])
3
- tree_nodes.map do |tree_node, sub_tree_nodes|
4
- li_classes = 'dd-item dd3-item'
5
-
6
- content_tag :li, class: li_classes, :'data-id' => tree_node.id do
7
-
8
- output = content_tag :div, 'drag', class: 'dd-handle dd3-handle'
9
- output+= content_tag :div, class: 'dd3-content' do
10
- content = link_to @model_config.with(object: tree_node).object_label, edit_path(@abstract_model, tree_node.id)
11
- content+= content_tag :div, action_links(tree_node), class: 'pull-right links'
12
- end
13
-
14
- if sub_tree_nodes && sub_tree_nodes.any?
15
- output+= content_tag :ol, nested_tree_nodes(sub_tree_nodes), class: 'dd-list'
16
- end
17
-
18
- output
19
- end
20
- end.join.html_safe
21
- end
22
-
23
- def action_links(model)
24
- content_tag :ul, class: 'inline actions' do
25
- menu_for :member, @abstract_model, model, true
26
- end
27
- end
28
-
29
- def tree_max_depth
30
- @nestable_conf.options[:max_depth] || 'false'
31
- end
32
-
33
1
  .row-fluid
34
2
  .span12#rails_admin_nestable
35
3
  #tree_nodes.dd{:'data-update-path' => nestable_path(model_name: @abstract_model), :'data-max-depth' => tree_max_depth}
@@ -9,5 +9,5 @@ require 'rails_admin/config/model'
9
9
  require 'rails_admin_nestable/configuration'
10
10
  require 'rails_admin_nestable/nestable'
11
11
  require 'rails_admin_nestable/model'
12
- # require 'rails_admin_nestable/helper'
12
+ require 'rails_admin_nestable/helper'
13
13
 
@@ -1,4 +1,13 @@
1
1
  module RailsAdminNestable
2
2
  class Engine < ::Rails::Engine
3
+
4
+ initializer "RailsAdminNestable precompile hook", group: :all do |app|
5
+ app.config.assets.precompile += %w(rails_admin/rails_admin_nestable.js rails_admin/rails_admin_nestable.css)
6
+ end
7
+
8
+ initializer 'Include RailsAdminNestable::Helper' do |app|
9
+ ActionView::Base.send :include, RailsAdminNestable::Helper
10
+ end
11
+
3
12
  end
4
13
  end
@@ -81,7 +81,7 @@ module RailsAdmin
81
81
  end
82
82
 
83
83
  register_instance_option :link_icon do
84
- 'icon-align-left'
84
+ 'icon-move'
85
85
  end
86
86
 
87
87
  register_instance_option :http_methods do
@@ -1,3 +1,3 @@
1
1
  module RailsAdminNestable
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: