rails_admin_nested_set 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaca614b321bd75f019961125d72f029934c634c
|
4
|
+
data.tar.gz: 9b7a9a427601f078c45af3463f93c18f5147ff25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6c0547158f84e74c8d6d3011fe6873603343b5bb772a43cccb235e0226ba4fca676cf8e0c88d8d4f9f57b8023c09ed9685623d8967ce7431036e57990f23788
|
7
|
+
data.tar.gz: aab28c14ec9e03696cf0b52b6b517462481b1fb255274087daca047d7d7f781ae0c92bbd129d1a1c7afdb6078f0ebbca764832a304cd07c125937cac7c5b37f9
|
@@ -35,10 +35,26 @@
|
|
35
35
|
line-height: 20px;
|
36
36
|
}
|
37
37
|
|
38
|
+
.dd-item .badge {
|
39
|
+
margin-right: 10px;
|
40
|
+
}
|
41
|
+
|
42
|
+
.dd-item img {
|
43
|
+
display: inline-block;
|
44
|
+
margin-left: 10px;
|
45
|
+
}
|
46
|
+
|
47
|
+
.dd-item > div {
|
48
|
+
position: relative
|
49
|
+
}
|
50
|
+
|
38
51
|
.dd-handle {
|
39
52
|
display: block;
|
40
|
-
|
41
|
-
|
53
|
+
position: absolute;
|
54
|
+
top: 0;
|
55
|
+
left: 0;
|
56
|
+
bottom: 0;
|
57
|
+
width: 30px;
|
42
58
|
padding: 5px 10px;
|
43
59
|
color: #333;
|
44
60
|
text-decoration: none;
|
@@ -74,7 +90,7 @@
|
|
74
90
|
|
75
91
|
.dd3-content {
|
76
92
|
display: block;
|
77
|
-
height: 30px;
|
93
|
+
min-height: 30px;
|
78
94
|
padding: 5px 10px 5px 40px;
|
79
95
|
color: #333;
|
80
96
|
text-decoration: none;
|
@@ -9,6 +9,14 @@ module RailsAdminNestedSet
|
|
9
9
|
content + content_tag(:script, js.html_safe, type: 'text/javascript')
|
10
10
|
end
|
11
11
|
|
12
|
+
def g_link(node, fv, on, badge)
|
13
|
+
link_to(
|
14
|
+
fv.html_safe,
|
15
|
+
toggle_path(model_name: @abstract_model, id: node.id, method: 'enabled', on: on.to_s),
|
16
|
+
method: :post,
|
17
|
+
class: 'badge ' + badge,
|
18
|
+
)
|
19
|
+
end
|
12
20
|
|
13
21
|
def rails_admin_nested_set_builder(nodes, tree)
|
14
22
|
nodes.map do |node|
|
@@ -17,8 +25,29 @@ module RailsAdminNestedSet
|
|
17
25
|
content_tag :li, class: li_classes, :'data-id' => node.id do
|
18
26
|
output = content_tag :div, 'drag', class: 'dd-handle dd3-handle'
|
19
27
|
output+= content_tag :div, class: 'dd3-content' do
|
20
|
-
content =
|
21
|
-
|
28
|
+
content = ''.html_safe
|
29
|
+
|
30
|
+
if node.respond_to?(:enabled) && respond_to?(:toggle_path)
|
31
|
+
content += case node.enabled
|
32
|
+
when nil
|
33
|
+
g_link(node, '✘', 0, 'badge-important') + g_link(node, '✓', 1, 'badge-success')
|
34
|
+
when false
|
35
|
+
g_link(node, '✘', 1, 'badge-important')
|
36
|
+
when true
|
37
|
+
g_link(node, '✓', 0, 'badge-success')
|
38
|
+
else
|
39
|
+
%{<span class="badge">-</span>}
|
40
|
+
end.html_safe
|
41
|
+
end
|
42
|
+
|
43
|
+
content += link_to @model_config.with(object: node).object_label, edit_path(@abstract_model, node.id)
|
44
|
+
[:cover, :image].each do |mth|
|
45
|
+
if node.respond_to?(mth)
|
46
|
+
content += image_tag(node.send(mth), style: "max-height: 90px")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
content += content_tag(:div, action_links(node), class: 'pull-right links')
|
50
|
+
content
|
22
51
|
end
|
23
52
|
|
24
53
|
children = tree.select{|elem| elem.parent_id == node.id}
|