rails_admin_nestable 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/rails_admin/rails_admin_nestable.js.coffee +34 -19
- data/app/views/rails_admin/main/nestable.html.haml +6 -2
- data/config/locales/nestable.en.yml +2 -0
- data/config/locales/nestable.es.yml +15 -0
- data/config/locales/nestable.it.yml +2 -0
- data/config/locales/nestable.sv.yml +14 -0
- data/lib/rails_admin_nestable/engine.rb +1 -1
- data/lib/rails_admin_nestable/version.rb +1 -1
- metadata +97 -91
@@ -1,7 +1,39 @@
|
|
1
1
|
jQuery ->
|
2
|
+
updateNodes = (tree_nodes) ->
|
3
|
+
serialized_tree = tree_nodes.nestable('serialize')
|
4
|
+
|
5
|
+
$.ajax
|
6
|
+
url: tree_nodes.data('update-path'),
|
7
|
+
type: 'POST',
|
8
|
+
data:
|
9
|
+
tree_nodes: serialized_tree
|
10
|
+
success: (data) ->
|
11
|
+
$flash = $('<div>')
|
12
|
+
.addClass('nestable-flash alert')
|
13
|
+
.append( $('<button>').addClass('close').data('dismiss', 'alert').html('×') )
|
14
|
+
.append( $('<span>').addClass('body').html( data ) )
|
15
|
+
|
16
|
+
$('#rails_admin_nestable')
|
17
|
+
.append( $flash )
|
18
|
+
|
19
|
+
$flash.fadeIn(200)
|
20
|
+
.delay(2000).fadeOut 200, ->
|
21
|
+
$(this).remove()
|
22
|
+
|
2
23
|
$tree_nodes = $('#tree_nodes')
|
3
24
|
$tree_nodes_options = {}
|
4
25
|
$tree_nodes_max_depth = $tree_nodes.data('max-depth')
|
26
|
+
$live_update = $('#rails_admin_nestable input[type=checkbox]')
|
27
|
+
$update_button = $('#rails_admin_nestable button')
|
28
|
+
live_update_mode = $live_update.prop('checked')
|
29
|
+
$('#rails_admin_nestable button').prop('disabled', $live_update.prop('checked'))
|
30
|
+
|
31
|
+
$live_update.change ->
|
32
|
+
live_update_mode = $(this).prop('checked')
|
33
|
+
$update_button.prop('disabled', live_update_mode)
|
34
|
+
|
35
|
+
$update_button.click ->
|
36
|
+
updateNodes($tree_nodes)
|
5
37
|
|
6
38
|
if $tree_nodes_max_depth && $tree_nodes_max_depth != 'false'
|
7
39
|
$tree_nodes_options['maxDepth'] = $tree_nodes_max_depth
|
@@ -10,22 +42,5 @@ jQuery ->
|
|
10
42
|
.nestable( $tree_nodes_options )
|
11
43
|
.on
|
12
44
|
change: (event) ->
|
13
|
-
|
14
|
-
|
15
|
-
$.ajax
|
16
|
-
url: $tree_nodes.data('update-path'),
|
17
|
-
type: 'POST',
|
18
|
-
data:
|
19
|
-
tree_nodes: serialized_tree
|
20
|
-
success: (data) ->
|
21
|
-
$flash = $('<div>')
|
22
|
-
.addClass('nestable-flash alert')
|
23
|
-
.append( $('<button>').addClass('close').data('dismiss', 'alert').html('×') )
|
24
|
-
.append( $('<span>').addClass('body').html( data ) )
|
25
|
-
|
26
|
-
$('#rails_admin_nestable')
|
27
|
-
.append( $flash )
|
28
|
-
|
29
|
-
$flash.fadeIn(200)
|
30
|
-
.delay(2000).fadeOut 200, ->
|
31
|
-
$(this).remove()
|
45
|
+
if live_update_mode
|
46
|
+
updateNodes($tree_nodes)
|
@@ -1,10 +1,14 @@
|
|
1
1
|
.row-fluid
|
2
2
|
.span12#rails_admin_nestable
|
3
|
+
.control-group
|
4
|
+
%label{:class => 'checkbox inline' }
|
5
|
+
%input{ :type => 'checkbox' }= t('admin.actions.nestable.live_update')
|
3
6
|
#tree_nodes.dd{:'data-update-path' => nestable_path(model_name: @abstract_model), :'data-max-depth' => tree_max_depth}
|
4
7
|
%ol.dd-list
|
5
8
|
= nested_tree_nodes @tree_nodes
|
9
|
+
.form-actions
|
10
|
+
%button{ :type => 'submit', :class => 'btn btn-small btn-primary' }= t('admin.actions.nestable.update')
|
6
11
|
|
7
|
-
|
8
|
-
= stylesheet_link_tag 'rails_admin/rails_admin_nestable'
|
12
|
+
= stylesheet_link_tag 'rails_admin/rails_admin_nestable'
|
9
13
|
= javascript_include_tag 'rails_admin/jquery.nestable'
|
10
14
|
= javascript_include_tag 'rails_admin/rails_admin_nestable'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
es:
|
3
|
+
admin:
|
4
|
+
actions:
|
5
|
+
nestable:
|
6
|
+
title: "Ordenación para %{model_label}"
|
7
|
+
menu: "Ordenación"
|
8
|
+
breadcrumb: "Ordenación"
|
9
|
+
link: "Ordenación"
|
10
|
+
bulk_link: "Seleccionar ordenados %{model_label_plural}"
|
11
|
+
done: "Ordenado"
|
12
|
+
success: "Actualizado con éxito"
|
13
|
+
error: "Error"
|
14
|
+
update: "Actualizar"
|
15
|
+
live_update: "Actualizar en vivo"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
sv:
|
2
|
+
admin:
|
3
|
+
actions:
|
4
|
+
nestable:
|
5
|
+
title: "Sortering för %{model_label}"
|
6
|
+
menu: "Sortering"
|
7
|
+
breadcrumb: "Sortering"
|
8
|
+
link: "Sortering"
|
9
|
+
bulk_link: "Vald sortering %{model_label_plural}"
|
10
|
+
done: "Sorterad"
|
11
|
+
success: "Sparad"
|
12
|
+
error: "Fel"
|
13
|
+
update: "Uppdatera"
|
14
|
+
live_update: "Uppdatera i realtid"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module RailsAdminNestable
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
|
4
|
-
initializer "RailsAdminNestable precompile hook" do |app|
|
4
|
+
initializer "RailsAdminNestable precompile hook", group: :all do |app|
|
5
5
|
app.config.assets.precompile += %w(rails_admin/rails_admin_nestable.js rails_admin/jquery.nestable.js rails_admin/rails_admin_nestable.css)
|
6
6
|
end
|
7
7
|
|
metadata
CHANGED
@@ -1,100 +1,113 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_nestable
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 4
|
9
|
-
version: 0.1.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Andrea Dal Ponte
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rails
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 3
|
29
|
-
- 1
|
30
|
-
version: "3.1"
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.1'
|
31
22
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: rails_admin
|
35
23
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rails_admin
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
43
38
|
type: :runtime
|
44
|
-
version_requirements: *id002
|
45
|
-
- !ruby/object:Gem::Dependency
|
46
|
-
name: haml-rails
|
47
39
|
prerelease: false
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: haml-rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
55
54
|
type: :runtime
|
56
|
-
version_requirements: *id003
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: coffee-rails
|
59
55
|
prerelease: false
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: coffee-rails
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
67
70
|
type: :runtime
|
68
|
-
version_requirements: *id004
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: sass-rails
|
71
71
|
prerelease: false
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: sass-rails
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
79
86
|
type: :runtime
|
80
|
-
|
81
|
-
|
82
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Rails Admin plugin to organise Tree/List models with a simple drag and
|
95
|
+
drop custom action
|
96
|
+
email:
|
83
97
|
- info@andreadalponte.com
|
84
98
|
executables: []
|
85
|
-
|
86
99
|
extensions: []
|
87
|
-
|
88
100
|
extra_rdoc_files: []
|
89
|
-
|
90
|
-
files:
|
101
|
+
files:
|
91
102
|
- app/assets/javascripts/rails_admin/jquery.nestable.js
|
92
103
|
- app/assets/javascripts/rails_admin/rails_admin_nestable.js.coffee
|
93
104
|
- app/assets/stylesheets/rails_admin/rails_admin_nestable.css.scss
|
94
105
|
- app/helpers/rails_admin/nestable_helper.rb
|
95
106
|
- app/views/rails_admin/main/nestable.html.haml
|
96
107
|
- config/locales/nestable.en.yml
|
108
|
+
- config/locales/nestable.es.yml
|
97
109
|
- config/locales/nestable.it.yml
|
110
|
+
- config/locales/nestable.sv.yml
|
98
111
|
- lib/rails_admin_nestable/configuration.rb
|
99
112
|
- lib/rails_admin_nestable/engine.rb
|
100
113
|
- lib/rails_admin_nestable/helper.rb
|
@@ -105,35 +118,28 @@ files:
|
|
105
118
|
- MIT-LICENSE
|
106
119
|
- Rakefile
|
107
120
|
- README.md
|
108
|
-
has_rdoc: true
|
109
121
|
homepage: https://github.com/dalpo/rails_admin_nestable
|
110
122
|
licenses: []
|
111
|
-
|
112
123
|
post_install_message:
|
113
124
|
rdoc_options: []
|
114
|
-
|
115
|
-
require_paths:
|
125
|
+
require_paths:
|
116
126
|
- lib
|
117
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
requirements:
|
126
|
-
- -
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
|
129
|
-
- 0
|
130
|
-
version: "0"
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
131
139
|
requirements: []
|
132
|
-
|
133
140
|
rubyforge_project:
|
134
|
-
rubygems_version: 1.
|
141
|
+
rubygems_version: 1.8.25
|
135
142
|
signing_key:
|
136
143
|
specification_version: 3
|
137
144
|
summary: Reorganise model data with a drag and drop tree/list structure
|
138
145
|
test_files: []
|
139
|
-
|