the_sortable_tree 2.6.2 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/the_sortable_tree_controller.rb +16 -9
- data/gem_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c2ff9a42282d3c3f5a81370e9c46fb36ce85d26
|
4
|
+
data.tar.gz: 8b5f2d363255232c6650cad8ca12d448b0645be6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0197daa88063c8b93616a641f0286b1989f69bbd9464ff8298c266a03c769f592a9b401907f871d3299f3ab671409d056f8d546de4adf6822e2b96acd500abbb'
|
7
|
+
data.tar.gz: 6108bdc36652cc3565657d007d3a174b22a39d9ab647678ca067b6b56cad505ccd2fb87bde1bd045a87dcf4f7c8d6130ba3c24169bc4d44641eceee866ea7844
|
@@ -2,7 +2,14 @@ module TheSortableTreeController
|
|
2
2
|
# include TheSortableTreeController::Rebuild
|
3
3
|
# include TheSortableTreeController::ExpandNode
|
4
4
|
# include TheSortableTreeController::ReversedRebuild
|
5
|
-
|
5
|
+
|
6
|
+
module DefineDeprecatedMethods
|
7
|
+
public
|
8
|
+
def head_respond(status = :ok)
|
9
|
+
Rails::VERSION::STRING.to_f >= 5.1 ? head(status) : render(nothing: true, status: status)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
6
13
|
module DefineVariablesMethod
|
7
14
|
public
|
8
15
|
def the_define_common_variables
|
@@ -13,19 +20,19 @@ module TheSortableTreeController
|
|
13
20
|
["@#{variable}", collection, klass]
|
14
21
|
end
|
15
22
|
end
|
16
|
-
|
23
|
+
|
17
24
|
module ExpandNode
|
18
25
|
include DefineVariablesMethod
|
19
26
|
def expand_node
|
20
27
|
id = params[:id].to_i
|
21
|
-
return
|
28
|
+
return head_respond unless id
|
22
29
|
sort = (params[:tree_sort] == 'reversed') ? 'reversed_' : nil
|
23
30
|
|
24
31
|
variable, collection, klass = self.the_define_common_variables
|
25
32
|
variable = self.instance_variable_set(variable, klass.find(id))
|
26
33
|
@children = variable.children.send("#{sort}nested_set")
|
27
34
|
|
28
|
-
return
|
35
|
+
return head_respond if @children.count.zero?
|
29
36
|
render layout: false, template: "#{collection}/expand_node"
|
30
37
|
end
|
31
38
|
end
|
@@ -39,7 +46,7 @@ module TheSortableTreeController
|
|
39
46
|
prev_id = params[:prev_id].to_i
|
40
47
|
next_id = params[:next_id].to_i
|
41
48
|
|
42
|
-
return
|
49
|
+
return head_respond(:no_content) if parent_id.zero? && prev_id.zero? && next_id.zero?
|
43
50
|
|
44
51
|
variable, collection, klass = self.the_define_common_variables
|
45
52
|
variable = self.instance_variable_set(variable, klass.find(id))
|
@@ -52,10 +59,10 @@ module TheSortableTreeController
|
|
52
59
|
variable.move_to_left_of klass.find(next_id)
|
53
60
|
end
|
54
61
|
|
55
|
-
|
62
|
+
head_respond
|
56
63
|
end
|
57
64
|
end
|
58
|
-
|
65
|
+
|
59
66
|
module ReversedRebuild
|
60
67
|
include DefineVariablesMethod
|
61
68
|
public
|
@@ -65,7 +72,7 @@ module TheSortableTreeController
|
|
65
72
|
prev_id = params[:prev_id].to_i
|
66
73
|
next_id = params[:next_id].to_i
|
67
74
|
|
68
|
-
return
|
75
|
+
return head_respond(:no_content) if parent_id.zero? && prev_id.zero? && next_id.zero?
|
69
76
|
|
70
77
|
variable, collection, klass = self.the_define_common_variables
|
71
78
|
variable = self.instance_variable_set(variable, klass.find(id))
|
@@ -78,7 +85,7 @@ module TheSortableTreeController
|
|
78
85
|
variable.move_to_right_of klass.find(next_id)
|
79
86
|
end
|
80
87
|
|
81
|
-
|
88
|
+
head_respond
|
82
89
|
end
|
83
90
|
end
|
84
91
|
end
|
data/gem_version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_sortable_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya N. Zykin, Mikhail Dieterle, Matthew Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|