rails_admin_sort_embedded 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +1 -0
- data/app/assets/javascripts/rails_admin/rails_admin_sort_embedded.js.coffee +1 -1
- data/app/assets/stylesheets/rails_admin/rails_admin_sort_embedded.css.scss +163 -161
- data/app/views/rails_admin/main/sort_embedded.html.haml +3 -3
- data/config/locales/{ru.nested_set.yml → ru.rails_admin_sort_embedded.yml} +0 -0
- data/lib/rails_admin_sort_embedded/configuration.rb +1 -0
- data/lib/rails_admin_sort_embedded/helper.rb +7 -1
- data/lib/rails_admin_sort_embedded/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 296262c268c40b46857a44119568e179bd021116
|
4
|
+
data.tar.gz: 01e19afc1ec69e02bc1dee0e34a8097bd5b006a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84a89bfbce46518730bec065ed47e613d177c7e67a38a2d931f0878cd3516042b6375994d1e9ec73835a24b22b067221056b9375680c0b347a964b6c18447ad8
|
7
|
+
data.tar.gz: 57fa4dc82449e1f575d1e1d39d7dd7586fba69f4418fa43c0bad820a5ee9f622a9f382e4fe2fdca02e22ffe3534bef58ff979e54a2c049d9dcaf42901af74728
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.2
|
data/README.md
CHANGED
@@ -55,6 +55,7 @@ In parent model:
|
|
55
55
|
rails_admin do ...
|
56
56
|
sort_embedded({
|
57
57
|
fields: [{model: [:order_field_1, :order_scope_1]}, {model: [:order_field_2, :order_scope_2]}...],
|
58
|
+
label_methods: [:name, :label],
|
58
59
|
toggle_fields: [:enabled],
|
59
60
|
thumbnail_fields: [:image, :cover],
|
60
61
|
thumbnail_size: :thumb,
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
show_flash = (selector, data)->
|
4
4
|
$flash = $('<div>')
|
5
|
-
.addClass('
|
5
|
+
.addClass('sort-embedded-flash alert')
|
6
6
|
.append($('<button>').addClass('close').data('dismiss', 'alert').html('×'))
|
7
7
|
.append($('<span>').addClass('body').html(data))
|
8
8
|
$(selector).append($flash)
|
@@ -2,194 +2,196 @@
|
|
2
2
|
* jQuery Nestable
|
3
3
|
*/
|
4
4
|
|
5
|
-
.dd {
|
6
|
-
position: relative;
|
7
|
-
display: block;
|
8
|
-
margin: 0;
|
9
|
-
padding: 0;
|
10
|
-
/* max-width: 600px; */
|
11
|
-
list-style: none;
|
12
|
-
font-size: 13px;
|
13
|
-
line-height: 20px;
|
14
|
-
}
|
15
5
|
|
16
|
-
.
|
17
|
-
|
6
|
+
.rails_admin_sort_embedded {
|
7
|
+
|
18
8
|
position: relative;
|
19
|
-
margin:
|
20
|
-
padding: 0;
|
21
|
-
list-style: none;
|
22
|
-
}
|
9
|
+
margin-bottom: 100px;
|
23
10
|
|
24
|
-
.dd
|
25
|
-
|
26
|
-
|
11
|
+
.dd {
|
12
|
+
position: relative;
|
13
|
+
display: block;
|
14
|
+
margin: 0;
|
15
|
+
padding: 0;
|
16
|
+
/* max-width: 600px; */
|
17
|
+
list-style: none;
|
18
|
+
font-size: 13px;
|
19
|
+
line-height: 20px;
|
20
|
+
}
|
27
21
|
|
28
|
-
.dd-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
line-height: 20px;
|
36
|
-
}
|
22
|
+
.dd-list, .dd-list ol {
|
23
|
+
display: block;
|
24
|
+
position: relative;
|
25
|
+
margin: 0;
|
26
|
+
padding: 0;
|
27
|
+
list-style: none;
|
28
|
+
}
|
37
29
|
|
38
|
-
.dd-
|
39
|
-
|
40
|
-
}
|
30
|
+
.dd-list ol {
|
31
|
+
padding-left: 30px;
|
32
|
+
}
|
41
33
|
|
42
|
-
.dd-item
|
43
|
-
|
44
|
-
|
45
|
-
|
34
|
+
.dd-item, .dd-placeholder {
|
35
|
+
display: block;
|
36
|
+
position: relative;
|
37
|
+
margin: 0;
|
38
|
+
padding: 0;
|
39
|
+
min-height: 20px;
|
40
|
+
font-size: 13px;
|
41
|
+
line-height: 20px;
|
42
|
+
}
|
46
43
|
|
47
|
-
.dd-item
|
48
|
-
|
49
|
-
}
|
44
|
+
.dd-item .label {
|
45
|
+
margin-right: 10px;
|
46
|
+
}
|
50
47
|
|
51
|
-
.dd-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
left: 0;
|
56
|
-
bottom: 0;
|
57
|
-
width: 30px;
|
58
|
-
padding: 5px 10px;
|
59
|
-
color: #333;
|
60
|
-
text-decoration: none;
|
61
|
-
font-weight: bold;
|
62
|
-
border: 1px solid #ccc;
|
63
|
-
background: #fafafa;
|
64
|
-
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
|
65
|
-
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
|
66
|
-
background: linear-gradient(top, #fafafa 0%, #eee 100%);
|
67
|
-
-webkit-border-radius: 3px;
|
68
|
-
border-radius: 3px;
|
69
|
-
box-sizing: border-box;
|
70
|
-
-moz-box-sizing: border-box;
|
71
|
-
cursor: move;
|
72
|
-
}
|
48
|
+
.dd-item img {
|
49
|
+
display: inline-block;
|
50
|
+
margin-left: 10px;
|
51
|
+
}
|
73
52
|
|
74
|
-
.dd-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
53
|
+
.dd-item > div {
|
54
|
+
// position: relative
|
55
|
+
}
|
78
56
|
|
79
|
-
.dd-
|
80
|
-
|
81
|
-
|
57
|
+
.dd-handle {
|
58
|
+
display: block;
|
59
|
+
position: absolute;
|
60
|
+
top: 0;
|
61
|
+
left: 0;
|
62
|
+
bottom: 0;
|
63
|
+
width: 30px;
|
64
|
+
padding: 5px 10px;
|
65
|
+
color: #333;
|
66
|
+
text-decoration: none;
|
67
|
+
font-weight: bold;
|
68
|
+
border: 1px solid #ccc;
|
69
|
+
background: #fafafa;
|
70
|
+
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
|
71
|
+
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
|
72
|
+
background: linear-gradient(top, #fafafa 0%, #eee 100%);
|
73
|
+
-webkit-border-radius: 3px;
|
74
|
+
border-radius: 3px;
|
75
|
+
box-sizing: border-box;
|
76
|
+
-moz-box-sizing: border-box;
|
77
|
+
cursor: move;
|
78
|
+
}
|
82
79
|
|
83
|
-
.dd-
|
84
|
-
|
85
|
-
|
86
|
-
min-height: 30px;
|
87
|
-
background: #f2fbff;
|
88
|
-
border: 1px dashed #b6bcbf;
|
89
|
-
&.mjs-nestedSortable-error {
|
90
|
-
border: 1px solid red;
|
80
|
+
.dd-handle:hover {
|
81
|
+
color: #2ea8e5;
|
82
|
+
background: #fff;
|
91
83
|
}
|
92
|
-
}
|
93
84
|
|
94
|
-
.
|
95
|
-
|
96
|
-
|
97
|
-
padding: 5px 10px 5px 40px;
|
98
|
-
color: #333;
|
99
|
-
text-decoration: none;
|
100
|
-
font-weight: bold;
|
101
|
-
border: 1px solid #ccc;
|
102
|
-
background: #fafafa;
|
103
|
-
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
|
104
|
-
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
|
105
|
-
background: linear-gradient(top, #fafafa 0%, #eee 100%);
|
106
|
-
-webkit-border-radius: 3px;
|
107
|
-
border-radius: 3px;
|
108
|
-
box-sizing: border-box;
|
109
|
-
-moz-box-sizing: border-box;
|
110
|
-
}
|
85
|
+
.dd-item {
|
86
|
+
margin-top: 5px
|
87
|
+
}
|
111
88
|
|
112
|
-
.
|
113
|
-
|
114
|
-
|
115
|
-
|
89
|
+
.dd-placeholder {
|
90
|
+
margin: 5px 0;
|
91
|
+
padding: 0;
|
92
|
+
min-height: 30px;
|
93
|
+
background: #f2fbff;
|
94
|
+
border: 1px dashed #b6bcbf;
|
95
|
+
&.mjs-nestedSortable-error {
|
96
|
+
border: 1px solid red;
|
97
|
+
}
|
98
|
+
}
|
116
99
|
|
117
|
-
.
|
118
|
-
|
119
|
-
|
100
|
+
.dd3-content {
|
101
|
+
display: block;
|
102
|
+
min-height: 30px;
|
103
|
+
padding: 5px 10px 5px 40px;
|
104
|
+
color: #333;
|
105
|
+
text-decoration: none;
|
106
|
+
font-weight: bold;
|
107
|
+
border: 1px solid #ccc;
|
108
|
+
background: #fafafa;
|
109
|
+
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
|
110
|
+
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
|
111
|
+
background: linear-gradient(top, #fafafa 0%, #eee 100%);
|
112
|
+
-webkit-border-radius: 3px;
|
113
|
+
border-radius: 3px;
|
114
|
+
box-sizing: border-box;
|
115
|
+
-moz-box-sizing: border-box;
|
116
|
+
}
|
120
117
|
|
121
|
-
.dd3-
|
122
|
-
|
123
|
-
|
118
|
+
.dd3-content:hover {
|
119
|
+
color: #2ea8e5;
|
120
|
+
background: #fff;
|
121
|
+
}
|
124
122
|
|
125
|
-
.dd3-
|
126
|
-
|
127
|
-
|
128
|
-
left: 0;
|
129
|
-
top: 0;
|
130
|
-
cursor: pointer;
|
131
|
-
width: 30px;
|
132
|
-
text-indent: 100px;
|
133
|
-
white-space: nowrap;
|
134
|
-
overflow: hidden;
|
135
|
-
border: 1px solid #aaa;
|
136
|
-
background: #ddd;
|
137
|
-
background: -webkit-linear-gradient(top, #ddd 0%, #bbb 100%);
|
138
|
-
background: -moz-linear-gradient(top, #ddd 0%, #bbb 100%);
|
139
|
-
background: linear-gradient(top, #ddd 0%, #bbb 100%);
|
140
|
-
border-top-right-radius: 0;
|
141
|
-
border-bottom-right-radius: 0;
|
142
|
-
}
|
123
|
+
.dd-dragel > .dd3-item > .dd3-content {
|
124
|
+
margin: 0;
|
125
|
+
}
|
143
126
|
|
144
|
-
.dd3-
|
145
|
-
|
146
|
-
|
147
|
-
position: absolute;
|
148
|
-
left: 0;
|
149
|
-
top: 3px;
|
150
|
-
width: 100%;
|
151
|
-
text-align: center;
|
152
|
-
text-indent: 0;
|
153
|
-
color: #fff;
|
154
|
-
font-size: 20px;
|
155
|
-
font-weight: normal;
|
156
|
-
}
|
127
|
+
.dd3-item > button {
|
128
|
+
margin-left: 30px;
|
129
|
+
}
|
157
130
|
|
158
|
-
.dd3-handle
|
159
|
-
|
160
|
-
|
131
|
+
.dd3-handle {
|
132
|
+
position: absolute;
|
133
|
+
margin: 0;
|
134
|
+
left: 0;
|
135
|
+
top: 0;
|
136
|
+
cursor: pointer;
|
137
|
+
width: 30px;
|
138
|
+
text-indent: 100px;
|
139
|
+
white-space: nowrap;
|
140
|
+
overflow: hidden;
|
141
|
+
border: 1px solid #aaa;
|
142
|
+
background: #ddd;
|
143
|
+
background: -webkit-linear-gradient(top, #ddd 0%, #bbb 100%);
|
144
|
+
background: -moz-linear-gradient(top, #ddd 0%, #bbb 100%);
|
145
|
+
background: linear-gradient(top, #ddd 0%, #bbb 100%);
|
146
|
+
border-top-right-radius: 0;
|
147
|
+
border-bottom-right-radius: 0;
|
148
|
+
}
|
161
149
|
|
162
|
-
.dd3-
|
163
|
-
|
164
|
-
|
150
|
+
.dd3-handle:before {
|
151
|
+
content: '≡';
|
152
|
+
display: block;
|
153
|
+
position: absolute;
|
154
|
+
left: 0;
|
155
|
+
top: 3px;
|
156
|
+
width: 100%;
|
157
|
+
text-align: center;
|
158
|
+
text-indent: 0;
|
159
|
+
color: #fff;
|
160
|
+
font-size: 20px;
|
161
|
+
font-weight: normal;
|
162
|
+
}
|
165
163
|
|
166
|
-
.dd3-
|
167
|
-
|
168
|
-
|
169
|
-
list-style: none;
|
170
|
-
display: block
|
171
|
-
}
|
164
|
+
.dd3-handle:hover {
|
165
|
+
background: #ddd;
|
166
|
+
}
|
172
167
|
|
173
|
-
.dd3-content
|
174
|
-
|
175
|
-
}
|
168
|
+
.dd3-content .links {
|
169
|
+
width: auto;
|
170
|
+
}
|
176
171
|
|
177
|
-
.dd3-content ul.inline.actions
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
172
|
+
.dd3-content ul.inline.actions {
|
173
|
+
margin: 0;
|
174
|
+
padding: 0;
|
175
|
+
list-style: none;
|
176
|
+
display: block
|
177
|
+
}
|
182
178
|
|
183
|
-
.dd3-content ul.inline.actions li
|
184
|
-
|
185
|
-
}
|
179
|
+
.dd3-content ul.inline.actions li {
|
180
|
+
display: inline-block
|
181
|
+
}
|
186
182
|
|
187
|
-
.
|
188
|
-
|
189
|
-
|
183
|
+
.dd3-content ul.inline.actions li a {
|
184
|
+
width: 14px;
|
185
|
+
height: 16px;
|
186
|
+
text-decoration: none;
|
187
|
+
}
|
188
|
+
|
189
|
+
.dd3-content ul.inline.actions li a:hover {
|
190
|
+
text-decoration: none;
|
191
|
+
}
|
190
192
|
}
|
191
193
|
|
192
|
-
.
|
194
|
+
.sort-embedded-flash {
|
193
195
|
position: fixed;
|
194
196
|
top: 80px;
|
195
197
|
width: auto;
|
@@ -42,11 +42,11 @@
|
|
42
42
|
|
43
43
|
.tab-pane{id: "sort_embedded_#{embedded_field}_#{embedded_model_order_field}"}
|
44
44
|
.row-fluid
|
45
|
-
.span12.
|
45
|
+
.span12.rails_admin_sort_embedded{id: "rails_admin_sort_embedded_#{embedded_field}_#{embedded_model_order_field}"}
|
46
46
|
= rails_admin_sort_embedded @object.send(embedded_field).send(embedded_model_ordered_scope).to_a, {embedded_field: embedded_field, embedded_model_order_field: embedded_model_order_field}
|
47
47
|
|
48
48
|
- else
|
49
49
|
.tab-pane{id: "sort_embedded_#{f}"}
|
50
50
|
.row-fluid
|
51
|
-
.span12.
|
52
|
-
= rails_admin_sort_embedded @object.send(f).ordered.to_a, {embedded_field: f}
|
51
|
+
.span12.rails_admin_sort_embedded{id: "rails_admin_sort_embedded_#{f}_order"}
|
52
|
+
= rails_admin_sort_embedded @object.send(f).ordered.to_a, {embedded_field: f}
|
File without changes
|
@@ -38,7 +38,9 @@ module RailsAdminSortEmbedded
|
|
38
38
|
# end
|
39
39
|
# end
|
40
40
|
|
41
|
-
|
41
|
+
_title = sort_embedded_label_methods.map { |m| node.send(m) if node.respond_to?(m) }.compact.first
|
42
|
+
_title = node.id if _title.blank?
|
43
|
+
content += content_tag :span, _title
|
42
44
|
|
43
45
|
# content += link_to @model_config.with(object: node).object_label, edit_path(@abstract_model, node.id)
|
44
46
|
# content += extra_fields(node)
|
@@ -110,6 +112,10 @@ module RailsAdminSortEmbedded
|
|
110
112
|
@sort_conf.options[:fields]
|
111
113
|
end
|
112
114
|
|
115
|
+
def sort_embedded_label_methods
|
116
|
+
@sort_conf.options[:label_methods]
|
117
|
+
end
|
118
|
+
|
113
119
|
# def max_depth
|
114
120
|
# @sort_conf.options[:max_depth] || '0'
|
115
121
|
# end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_sort_embedded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kiseliev
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails_admin
|
@@ -44,7 +44,7 @@ files:
|
|
44
44
|
- app/assets/javascripts/rails_admin/rails_admin_sort_embedded.js.coffee
|
45
45
|
- app/assets/stylesheets/rails_admin/rails_admin_sort_embedded.css.scss
|
46
46
|
- app/views/rails_admin/main/sort_embedded.html.haml
|
47
|
-
- config/locales/ru.
|
47
|
+
- config/locales/ru.rails_admin_sort_embedded.yml
|
48
48
|
- lib/rails_admin_sort_embedded.rb
|
49
49
|
- lib/rails_admin_sort_embedded/action.rb
|
50
50
|
- lib/rails_admin_sort_embedded/configuration.rb
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.4.
|
76
|
+
rubygems_version: 2.4.7
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Interface for editing a sorted embedded collections for rails_admin
|