rails_admin 0.6.7 → 0.6.8
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.
Potentially problematic release.
This version of rails_admin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/app/assets/javascripts/rails_admin/ra.datetimepicker.js +20 -4
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +14 -14
- data/app/assets/javascripts/rails_admin/ra.widgets.coffee +74 -0
- data/app/assets/javascripts/rails_admin/ui.coffee +5 -0
- data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +1 -1
- data/app/assets/stylesheets/rails_admin/base/theming.scss +92 -72
- data/app/assets/stylesheets/rails_admin/ra.calendar-additions.scss +9 -8
- data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +1 -0
- data/app/controllers/rails_admin/application_controller.rb +4 -2
- data/app/controllers/rails_admin/main_controller.rb +1 -1
- data/app/helpers/rails_admin/application_helper.rb +12 -2
- data/app/helpers/rails_admin/form_builder.rb +1 -5
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +2 -0
- data/app/views/layouts/rails_admin/application.html.haml +3 -6
- data/app/views/layouts/rails_admin/pjax.html.haml +1 -2
- data/app/views/rails_admin/main/_form_boolean.html.haml +3 -0
- data/app/views/rails_admin/main/_form_datetime.html.haml +2 -2
- data/app/views/rails_admin/main/_form_field.html.haml +1 -1
- data/app/views/rails_admin/main/_form_froala.html.haml +8 -0
- data/app/views/rails_admin/main/_form_nested_many.html.haml +3 -2
- data/app/views/rails_admin/main/_form_nested_one.html.haml +1 -1
- data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +3 -2
- data/app/views/rails_admin/main/_submit_buttons.html.haml +2 -4
- data/app/views/rails_admin/main/dashboard.html.haml +3 -3
- data/app/views/rails_admin/main/export.html.haml +14 -14
- data/lib/rails_admin/config.rb +6 -2
- data/lib/rails_admin/config/actions/base.rb +1 -1
- data/lib/rails_admin/config/actions/bulk_delete.rb +26 -13
- data/lib/rails_admin/config/actions/dashboard.rb +2 -2
- data/lib/rails_admin/config/fields.rb +1 -1
- data/lib/rails_admin/config/fields/base.rb +2 -1
- data/lib/rails_admin/config/fields/types/all.rb +2 -0
- data/lib/rails_admin/config/fields/types/boolean.rb +4 -0
- data/lib/rails_admin/config/fields/types/froala.rb +37 -0
- data/lib/rails_admin/config/fields/types/has_one_association.rb +1 -1
- data/lib/rails_admin/config/fields/types/uuid.rb +13 -0
- data/lib/rails_admin/config/has_fields.rb +5 -5
- data/lib/rails_admin/extensions/cancan.rb +1 -3
- data/lib/rails_admin/extensions/cancancan.rb +1 -3
- data/lib/rails_admin/extensions/history.rb +1 -3
- data/lib/rails_admin/extensions/paper_trail.rb +1 -3
- data/lib/rails_admin/support/csv_converter.rb +1 -1
- data/lib/rails_admin/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0409337248747730f7ea1bfeecd3c8a87970b95
|
4
|
+
data.tar.gz: a9a8e2ec8886981cdde444441df74ceaa5099e85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65f95de98ec19d04476bf20a64c6d930c35d76e99c5499a939bb78e2207d277effb01807f63d2e6cffa301c0a79ef6f9ddd5cfc48a18f4fbe8f0470ed69c88f4
|
7
|
+
data.tar.gz: ce24bd3ce10b5952c29ba58e0c25284bddb54abd0493328298750aa29c20c1ad878be3d2797ef2d462411b422c83e4f39cb1fb8876543540e26031367a803a96
|
data/Gemfile
CHANGED
@@ -26,11 +26,19 @@
|
|
26
26
|
this.element.hide();
|
27
27
|
|
28
28
|
if (this.options.showTime) {
|
29
|
+
var $wrap = $('<div class="input-group"/>');
|
30
|
+
|
29
31
|
this.timepicker = $('<input class="TIMEPICKER" type="text" value="' + this.options.timepicker.value + '" />');
|
30
32
|
|
31
|
-
this.timepicker.css("width", "
|
33
|
+
this.timepicker.css("width", "65px");
|
34
|
+
|
35
|
+
this.timepicker.addClass('form-control');
|
36
|
+
|
37
|
+
$wrap.append(this.timepicker);
|
38
|
+
|
39
|
+
$wrap.append($('<div class="input-group-addon"><i class="icon-time"></i></div>'));
|
32
40
|
|
33
|
-
|
41
|
+
$wrap.insertAfter(this.element);
|
34
42
|
|
35
43
|
this.timepicker.bind("change", function() { widget._onChange(); });
|
36
44
|
|
@@ -38,11 +46,19 @@
|
|
38
46
|
}
|
39
47
|
|
40
48
|
if (this.options.showDate) {
|
49
|
+
var $wrap = $('<div class="input-group"/>');
|
50
|
+
|
41
51
|
this.datepicker = $('<input type="text" value="' + this.options.datepicker.value + '" />');
|
42
52
|
|
43
|
-
this.datepicker.
|
53
|
+
this.datepicker.addClass('form-control');
|
54
|
+
|
55
|
+
$wrap.css("margin-right", "15px");
|
56
|
+
|
57
|
+
$wrap.append(this.datepicker);
|
58
|
+
|
59
|
+
$wrap.append($('<div class="input-group-addon"><i class="icon-calendar"></i></div>'));
|
44
60
|
|
45
|
-
|
61
|
+
$wrap.insertAfter(this.element);
|
46
62
|
|
47
63
|
this.datepicker.bind("change", function() { widget._onChange(); });
|
48
64
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
var operator_name = 'f[' + field_name + '][' + index + '][o]';
|
17
17
|
switch(field_type) {
|
18
18
|
case 'boolean':
|
19
|
-
var control = '<select class="input-
|
19
|
+
var control = '<select class="input-sm form-control" name="' + value_name + '">' +
|
20
20
|
'<option value="_discard">...</option>' +
|
21
21
|
'<option value="true"' + (field_value == "true" ? 'selected="selected"' : '') + '>' + RailsAdmin.I18n.t("true") + '</option>' +
|
22
22
|
'<option value="false"' + (field_value == "false" ? 'selected="selected"' : '') + '>' + RailsAdmin.I18n.t("false") + '</option>' +
|
@@ -28,7 +28,7 @@
|
|
28
28
|
case 'date':
|
29
29
|
case 'datetime':
|
30
30
|
case 'timestamp':
|
31
|
-
var control = '<select class="switch-additionnal-fieldsets input-
|
31
|
+
var control = '<select class="switch-additionnal-fieldsets input-sm form-control" name="' + operator_name + '">' +
|
32
32
|
'<option ' + (field_operator == "default" ? 'selected="selected"' : '') + ' data-additional-fieldset="default" value="default">' + RailsAdmin.I18n.t("date") + '</option>' +
|
33
33
|
'<option ' + (field_operator == "between" ? 'selected="selected"' : '') + ' data-additional-fieldset="between" value="between">' + RailsAdmin.I18n.t("between_and_") + '</option>' +
|
34
34
|
'<option ' + (field_operator == "today" ? 'selected="selected"' : '') + ' value="today">' + RailsAdmin.I18n.t("today") + '</option>' +
|
@@ -40,20 +40,20 @@
|
|
40
40
|
'<option ' + (field_operator == "_null" ? 'selected="selected"' : '') + ' value="_null" >' + RailsAdmin.I18n.t("is_blank") + '</option>' +
|
41
41
|
'</select>'
|
42
42
|
var additional_control =
|
43
|
-
'<input class="date additional-fieldset default input-
|
44
|
-
'<input placeholder="-∞" class="date additional-fieldset between input-
|
45
|
-
'<input placeholder="∞" class="date additional-fieldset between input-
|
43
|
+
'<input class="date additional-fieldset default input-sm form-control" style="display:' + ((!field_operator || field_operator == "default") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[0] || '') + '" /> ' +
|
44
|
+
'<input placeholder="-∞" class="date additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[1] || '') + '" /> ' +
|
45
|
+
'<input placeholder="∞" class="date additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="text" name="' + value_name + '[]" value="' + (field_value[2] || '') + '" />';
|
46
46
|
break;
|
47
47
|
case 'enum':
|
48
48
|
var multiple_values = ((field_value instanceof Array) ? true : false)
|
49
|
-
var control = '<select style="display:' + (multiple_values ? 'none' : 'inline-block') + '" ' + (multiple_values ? '' : 'name="' + value_name + '"') + ' data-name="' + value_name + '" class="select-single input-
|
49
|
+
var control = '<select style="display:' + (multiple_values ? 'none' : 'inline-block') + '" ' + (multiple_values ? '' : 'name="' + value_name + '"') + ' data-name="' + value_name + '" class="select-single input-sm form-control">' +
|
50
50
|
'<option value="_discard">...</option>' +
|
51
51
|
'<option ' + (field_value == "_present" ? 'selected="selected"' : '') + ' value="_present">' + RailsAdmin.I18n.t("is_present") + '</option>' +
|
52
52
|
'<option ' + (field_value == "_blank" ? 'selected="selected"' : '') + ' value="_blank">' + RailsAdmin.I18n.t("is_blank") + '</option>' +
|
53
53
|
'<option disabled="disabled">---------</option>' +
|
54
54
|
field_options +
|
55
55
|
'</select>' +
|
56
|
-
'<select multiple="multiple" style="display:' + (multiple_values ? 'inline-block' : 'none') + '" ' + (multiple_values ? 'name="' + value_name + '[]"' : '') + ' data-name="' + value_name + '[]" class="select-multiple input-
|
56
|
+
'<select multiple="multiple" style="display:' + (multiple_values ? 'inline-block' : 'none') + '" ' + (multiple_values ? 'name="' + value_name + '[]"' : '') + ' data-name="' + value_name + '[]" class="select-multiple input-sm form-control">' +
|
57
57
|
field_options +
|
58
58
|
'</select> ' +
|
59
59
|
'<a href="#" class="switch-select"><i class="icon-' + (multiple_values ? 'minus' : 'plus') + '"></i></a>';
|
@@ -61,7 +61,7 @@
|
|
61
61
|
case 'string':
|
62
62
|
case 'text':
|
63
63
|
case 'belongs_to_association':
|
64
|
-
var control = '<select class="switch-additionnal-fieldsets input-
|
64
|
+
var control = '<select class="switch-additionnal-fieldsets input-sm form-control" value="' + field_operator + '" name="' + operator_name + '">' +
|
65
65
|
'<option data-additional-fieldset="additional-fieldset"' + (field_operator == "like" ? 'selected="selected"' : '') + ' value="like">' + RailsAdmin.I18n.t("contains") + '</option>' +
|
66
66
|
'<option data-additional-fieldset="additional-fieldset"' + (field_operator == "is" ? 'selected="selected"' : '') + ' value="is">' + RailsAdmin.I18n.t("is_exactly") + '</option>' +
|
67
67
|
'<option data-additional-fieldset="additional-fieldset"' + (field_operator == "starts_with" ? 'selected="selected"' : '') + ' value="starts_with">' + RailsAdmin.I18n.t("starts_with") + '</option>' +
|
@@ -70,12 +70,12 @@
|
|
70
70
|
'<option ' + (field_operator == "_not_null" ? 'selected="selected"' : '') + ' value="_not_null">' + RailsAdmin.I18n.t("is_present") + '</option>' +
|
71
71
|
'<option ' + (field_operator == "_null" ? 'selected="selected"' : '') + ' value="_null">' + RailsAdmin.I18n.t("is_blank") + '</option>' +
|
72
72
|
'</select>'
|
73
|
-
var additional_control = '<input class="additional-fieldset input-
|
73
|
+
var additional_control = '<input class="additional-fieldset input-sm form-control" style="display:' + (field_operator == "_blank" || field_operator == "_present" ? 'none' : 'inline-block') + ';" type="text" name="' + value_name + '" value="' + field_value + '" /> ';
|
74
74
|
break;
|
75
75
|
case 'integer':
|
76
76
|
case 'decimal':
|
77
77
|
case 'float':
|
78
|
-
var control = '<select class="switch-additionnal-fieldsets input-
|
78
|
+
var control = '<select class="switch-additionnal-fieldsets input-sm form-control" name="' + operator_name + '">' +
|
79
79
|
'<option ' + (field_operator == "default" ? 'selected="selected"' : '') + ' data-additional-fieldset="default" value="default">' + RailsAdmin.I18n.t("number") + '</option>' +
|
80
80
|
'<option ' + (field_operator == "between" ? 'selected="selected"' : '') + ' data-additional-fieldset="between" value="between">' + RailsAdmin.I18n.t("between_and_") + '</option>' +
|
81
81
|
'<option disabled="disabled">---------</option>' +
|
@@ -83,12 +83,12 @@
|
|
83
83
|
'<option ' + (field_operator == "_null" ? 'selected="selected"' : '') + ' value="_null" >' + RailsAdmin.I18n.t("is_blank") + '</option>' +
|
84
84
|
'</select>'
|
85
85
|
var additional_control =
|
86
|
-
'<input class="additional-fieldset default input-
|
87
|
-
'<input placeholder="-∞" class="additional-fieldset between input-
|
88
|
-
'<input placeholder="∞" class="additional-fieldset between input-
|
86
|
+
'<input class="additional-fieldset default input-sm form-control" style="display:' + ((!field_operator || field_operator == "default") ? 'inline-block' : 'none') + ';" type="' + field_type + '" name="' + value_name + '[]" value="' + (field_value[0] || '') + '" /> ' +
|
87
|
+
'<input placeholder="-∞" class="additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="' + field_type + '" name="' + value_name + '[]" value="' + (field_value[1] || '') + '" /> ' +
|
88
|
+
'<input placeholder="∞" class="additional-fieldset between input-sm form-control" style="display:' + ((field_operator == "between") ? 'inline-block' : 'none') + ';" type="' + field_type + '" name="' + value_name + '[]" value="' + (field_value[2] || '') + '" />';
|
89
89
|
break;
|
90
90
|
default:
|
91
|
-
var control = '<input type="text" class="input-
|
91
|
+
var control = '<input type="text" class="input-sm form-control" name="' + value_name + '" value="' + field_value + '"/> ';
|
92
92
|
break;
|
93
93
|
}
|
94
94
|
|
@@ -217,3 +217,77 @@ $(document).on 'rails_admin.dom_ready', (e, content) ->
|
|
217
217
|
goBootstrapWysihtml5s(@array, config_options)
|
218
218
|
else
|
219
219
|
goBootstrapWysihtml5s(@array, config_options)
|
220
|
+
|
221
|
+
# froala_wysiwyg
|
222
|
+
|
223
|
+
goFroalaWysiwygs = (array) =>
|
224
|
+
array.each ->
|
225
|
+
options = $(@).data('options')
|
226
|
+
config_options = $.parseJSON(options['config_options'])
|
227
|
+
if config_options
|
228
|
+
if !config_options['inlineMode']
|
229
|
+
config_options['inlineMode'] = false
|
230
|
+
else
|
231
|
+
config_options = { inlineMode: false }
|
232
|
+
|
233
|
+
uploadEnabled =
|
234
|
+
if config_options['imageUploadURL']
|
235
|
+
config_options['imageUploadParams'] =
|
236
|
+
authenticity_token: $('meta[name=csrf-token]').attr('content')
|
237
|
+
|
238
|
+
$(@).addClass('froala-wysiwyged')
|
239
|
+
$(@).editable(config_options)
|
240
|
+
if uploadEnabled
|
241
|
+
$(@).on 'editable.imageError', (e, editor, error) ->
|
242
|
+
alert("error uploading image: " + error.message);
|
243
|
+
# Custom error message returned from the server.
|
244
|
+
if error.code == 0
|
245
|
+
|
246
|
+
# Bad link.
|
247
|
+
else if error.code == 1
|
248
|
+
|
249
|
+
# No link in upload response.
|
250
|
+
else if error.code == 2
|
251
|
+
|
252
|
+
# Error during image upload.
|
253
|
+
else if error.code == 3
|
254
|
+
|
255
|
+
# Parsing response failed.
|
256
|
+
else if error.code == 4
|
257
|
+
|
258
|
+
# Image too large.
|
259
|
+
else if error.code == 5
|
260
|
+
|
261
|
+
# Invalid image type.
|
262
|
+
else if error.code == 6
|
263
|
+
|
264
|
+
# Image can be uploaded only to same domain in IE 8 and IE 9.
|
265
|
+
else if error.code == 7
|
266
|
+
|
267
|
+
else
|
268
|
+
|
269
|
+
return
|
270
|
+
|
271
|
+
.on('editable.afterRemoveImage', (e, editor, $img) ->
|
272
|
+
# Set the image source to the image delete params.
|
273
|
+
editor.options.imageDeleteParams =
|
274
|
+
src: $img.attr('src')
|
275
|
+
authenticity_token: $('meta[name=csrf-token]').attr('content')
|
276
|
+
# Make the delete request.
|
277
|
+
editor.deleteImage $img
|
278
|
+
return
|
279
|
+
).on('editable.imageDeleteSuccess', (e, editor, data) ->
|
280
|
+
# handle success
|
281
|
+
).on 'editable.imageDeleteError', (e, editor, error) ->
|
282
|
+
# handle error
|
283
|
+
alert("error deleting image: " + error.message);
|
284
|
+
|
285
|
+
array = content.find('[data-richtext=froala-wysiwyg]').not('.froala-wysiwyged')
|
286
|
+
if array.length
|
287
|
+
options = $(array[0]).data('options')
|
288
|
+
if not $.isFunction($.fn.editable)
|
289
|
+
$('head').append('<link href="' + options['csspath'] + '" rel="stylesheet" media="all" type="text\/css">')
|
290
|
+
$.getScript options['jspath'], (script, textStatus, jqXHR) =>
|
291
|
+
goFroalaWysiwygs(array)
|
292
|
+
else
|
293
|
+
goFroalaWysiwygs(array)
|
@@ -69,6 +69,11 @@ $(document).on 'rails_admin.dom_ready', ->
|
|
69
69
|
|
70
70
|
$(".table").tooltip selector: "th[rel=tooltip]"
|
71
71
|
|
72
|
+
# Workaround for jquery-ujs formnovalidate issue:
|
73
|
+
# https://github.com/rails/jquery-ujs/issues/316
|
74
|
+
$('[formnovalidate]').on 'click', ->
|
75
|
+
$(this).closest('form').attr('novalidate', true)
|
76
|
+
|
72
77
|
$(document).on 'click', '#fields_to_export label input#check_all', () ->
|
73
78
|
elems = $('#fields_to_export label input')
|
74
79
|
if $('#fields_to_export label input#check_all').is ':checked'
|
@@ -89,7 +89,7 @@
|
|
89
89
|
box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
|
90
90
|
}
|
91
91
|
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #4F4F4F; text-decoration: none; }
|
92
|
-
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {
|
92
|
+
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { background-color: #b3e2f0; font-weight: normal; color: #313131; }
|
93
93
|
.ui-state-hover a, .ui-state-hover a:hover { color: #313131; text-decoration: none; }
|
94
94
|
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
|
95
95
|
outline: none;
|
@@ -10,11 +10,7 @@ body.rails_admin {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
/* room for upper navbar */
|
13
|
-
padding-top:
|
14
|
-
|
15
|
-
.reset-left {
|
16
|
-
padding-left: 0px;
|
17
|
-
}
|
13
|
+
padding-top: $navbar-height;
|
18
14
|
|
19
15
|
/* Application name */
|
20
16
|
.navbar .brand {
|
@@ -26,14 +22,32 @@ body.rails_admin {
|
|
26
22
|
}
|
27
23
|
|
28
24
|
.sidebar-nav {
|
29
|
-
padding:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
25
|
+
padding: 0;
|
26
|
+
background-color: $navbar-default-bg;
|
27
|
+
|
28
|
+
.dropdown-header {
|
29
|
+
padding: ($grid-gutter-width / 2) ($grid-gutter-width / 2) 3px;
|
30
|
+
font-weight: bold;
|
31
|
+
color: $gray;
|
32
|
+
text-transform: uppercase;
|
33
|
+
}
|
34
|
+
|
35
|
+
> .nav-stacked > li > a {
|
36
|
+
padding: $padding-base-vertical ($grid-gutter-width / 2);
|
37
|
+
border-radius: 0;
|
38
|
+
|
39
|
+
&.nav-level-1 {
|
40
|
+
padding-left: $grid-gutter-width;
|
41
|
+
}
|
42
|
+
|
43
|
+
&.nav-level-2 {
|
44
|
+
padding-left: ($grid-gutter-width * 1.5);
|
45
|
+
}
|
46
|
+
|
47
|
+
&.nav-level-3 {
|
48
|
+
padding-left: ($grid-gutter-width * 2);
|
49
|
+
}
|
50
|
+
}
|
37
51
|
}
|
38
52
|
|
39
53
|
/* fat labels in forms */
|
@@ -56,14 +70,14 @@ body.rails_admin {
|
|
56
70
|
}
|
57
71
|
|
58
72
|
&.denser {
|
73
|
+
margin-top: 30px;
|
59
74
|
.controls .nav {
|
60
|
-
margin
|
75
|
+
margin: 30px 0 0;
|
61
76
|
}
|
62
77
|
.remove_nested_fields,
|
63
78
|
.remove_nested_one_fields {
|
64
79
|
position:absolute;
|
65
80
|
}
|
66
|
-
margin:0px;
|
67
81
|
p {
|
68
82
|
font-size: 12px;
|
69
83
|
line-height: 16px;
|
@@ -77,15 +91,8 @@ body.rails_admin {
|
|
77
91
|
margin-bottom: 0px;
|
78
92
|
}
|
79
93
|
}
|
80
|
-
.control-group {
|
81
|
-
margin: 0px;
|
82
|
-
padding-top:15px;
|
83
|
-
}
|
84
|
-
.control-label {
|
85
|
-
// width:145px;
|
86
|
-
}
|
87
94
|
legend {
|
88
|
-
margin-bottom:
|
95
|
+
margin-bottom: 30px;
|
89
96
|
}
|
90
97
|
}
|
91
98
|
|
@@ -100,74 +107,72 @@ body.rails_admin {
|
|
100
107
|
display:block;
|
101
108
|
}
|
102
109
|
|
110
|
+
/* Put form controls above siblings to make them accessible */
|
111
|
+
.controls {
|
112
|
+
z-index: 1;
|
113
|
+
}
|
114
|
+
|
103
115
|
/* nested forms */
|
104
|
-
.tab-content
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
&:hover>.remove_nested_fields,
|
110
|
-
&:hover>.remove_nested_one_fields,
|
111
|
-
&>.remove_nested_one_fields.active {
|
112
|
-
display:block;
|
113
|
-
}
|
116
|
+
.tab-content {
|
117
|
+
.tab-pane {
|
118
|
+
@include clearfix;
|
119
|
+
border-left: 5px solid #049cdb;
|
120
|
+
position: relative;
|
114
121
|
|
115
|
-
|
116
|
-
|
117
|
-
fieldset {
|
118
|
-
margin-left:-10px;
|
119
|
-
.control-group > label {
|
122
|
+
fieldset {
|
123
|
+
padding-top: 30px;
|
120
124
|
}
|
121
|
-
|
122
|
-
|
123
|
-
margin-
|
125
|
+
|
126
|
+
.form-group {
|
127
|
+
margin-right: 0;
|
128
|
+
margin-left: -5px; /* Balance border-left */
|
129
|
+
}
|
130
|
+
|
131
|
+
& > .remove_nested_fields,
|
132
|
+
& > .remove_nested_one_fields {
|
133
|
+
display:block;
|
134
|
+
opacity: 0;
|
135
|
+
position: absolute;
|
136
|
+
top: 0px;
|
137
|
+
left: 5px;
|
138
|
+
-webkit-transition: opacity .15s ease;
|
139
|
+
transition: opacity .15s ease;
|
140
|
+
}
|
141
|
+
&:hover > .remove_nested_fields,
|
142
|
+
&:hover > .remove_nested_one_fields,
|
143
|
+
& > .remove_nested_one_fields.active {
|
144
|
+
opacity: 1;
|
124
145
|
}
|
125
146
|
}
|
126
147
|
}
|
127
148
|
|
128
149
|
/* double nesting, guys. Easy. */
|
129
150
|
.tab-content .tab-content .tab-pane {
|
130
|
-
border-color:lighten(#049cdb, 20%);
|
131
|
-
margin-left:10px;
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
}
|
136
|
-
legend {
|
137
|
-
margin-left:20px;
|
138
|
-
}
|
151
|
+
border-color: lighten(#049cdb, 20%);
|
152
|
+
margin-left: 10px;
|
153
|
+
|
154
|
+
.form-group {
|
155
|
+
margin-left: -15px; /* Balance border-left */
|
139
156
|
}
|
140
157
|
}
|
141
158
|
|
142
159
|
/* triple nesting!*/
|
143
160
|
.tab-content .tab-content .tab-content .tab-pane {
|
144
161
|
border-color:lighten(#049cdb, 30%);
|
145
|
-
margin-left:20px;
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
padding-left:30px;
|
150
|
-
width:115px;
|
151
|
-
}
|
152
|
-
legend {
|
153
|
-
margin-left:30px;
|
154
|
-
}
|
162
|
+
margin-left: 20px;
|
163
|
+
|
164
|
+
.form-group {
|
165
|
+
margin-left: -25px; /* Balance border-left */
|
155
166
|
}
|
156
167
|
}
|
157
168
|
|
158
169
|
/* totally awesome! nesting on 4 levels! */
|
159
170
|
.tab-content .tab-content .tab-content .tab-content .tab-pane {
|
160
171
|
border-color:lighten(#049cdb, 40%);
|
161
|
-
margin-left:30px;
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
padding-left:40px;
|
166
|
-
width:105px;
|
167
|
-
}
|
168
|
-
legend {
|
169
|
-
margin-left:40px;
|
170
|
-
}
|
172
|
+
margin-left: 30px;
|
173
|
+
|
174
|
+
.form-group {
|
175
|
+
margin-left: -35px; /* Balance border-left */
|
171
176
|
}
|
172
177
|
}
|
173
178
|
}
|
@@ -191,8 +196,12 @@ body.rails_admin {
|
|
191
196
|
}
|
192
197
|
|
193
198
|
/* tab links should match icon color */
|
194
|
-
.nav.nav-tabs
|
195
|
-
|
199
|
+
.nav.nav-tabs {
|
200
|
+
margin-bottom: 20px;
|
201
|
+
|
202
|
+
li.icon a {
|
203
|
+
color: #000;
|
204
|
+
}
|
196
205
|
}
|
197
206
|
|
198
207
|
/* Table cells behaviour */
|
@@ -290,3 +299,14 @@ body.rails_admin {
|
|
290
299
|
}
|
291
300
|
}
|
292
301
|
}
|
302
|
+
|
303
|
+
@media screen and (min-width: $screen-sm-min) {
|
304
|
+
body.rails_admin {
|
305
|
+
.sidebar-nav {
|
306
|
+
position: fixed;
|
307
|
+
top: $navbar-height;
|
308
|
+
bottom: 0;
|
309
|
+
overflow-y: scroll;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
}
|
@@ -33,12 +33,13 @@
|
|
33
33
|
.ui-timepicker-table td a {
|
34
34
|
width: auto;
|
35
35
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
|
37
|
+
.ui-state-hover,
|
38
|
+
.ui-widget-content .ui-state-hover,
|
39
|
+
.ui-widget-header .ui-state-hover,
|
40
|
+
.ui-state-focus,
|
41
|
+
.ui-widget-content .ui-state-focus,
|
42
|
+
.ui-widget-header .ui-state-focus {
|
43
|
+
background-color: transparent;
|
44
|
+
cursor: pointer;
|
44
45
|
}
|
@@ -90,6 +90,7 @@
|
|
90
90
|
@import "rails_admin/bootstrap/popovers";
|
91
91
|
@import "rails_admin/bootstrap/thumbnails";
|
92
92
|
@import "rails_admin/bootstrap/labels";
|
93
|
+
@import "rails_admin/bootstrap/panels";
|
93
94
|
@import "rails_admin/bootstrap/badges";
|
94
95
|
@import "rails_admin/bootstrap/progress-bars";
|
95
96
|
<%# @import "rails_admin/bootstrap/accordion"; %>
|
@@ -10,7 +10,7 @@ module RailsAdmin
|
|
10
10
|
class ActionNotAllowed < ::StandardError
|
11
11
|
end
|
12
12
|
|
13
|
-
class ApplicationController <
|
13
|
+
class ApplicationController < Config.parent_controller.constantize
|
14
14
|
newrelic_ignore if defined?(NewRelic)
|
15
15
|
|
16
16
|
before_filter :_authenticate!
|
@@ -58,7 +58,9 @@ module RailsAdmin
|
|
58
58
|
instance_eval(&RailsAdmin::Config.audit_with)
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
def user_for_paper_trail
|
62
|
+
_current_user.try(:id) || _current_user
|
63
|
+
end
|
62
64
|
|
63
65
|
rescue_from RailsAdmin::ObjectNotFound do
|
64
66
|
flash[:error] = I18n.t('admin.flash.object_not_found', model: @model_name, id: params[:id])
|
@@ -115,7 +115,7 @@ module RailsAdmin
|
|
115
115
|
|
116
116
|
def check_for_cancel
|
117
117
|
return unless params[:_continue] || (params[:bulk_action] && !params[:bulk_ids])
|
118
|
-
redirect_to(back_or_index,
|
118
|
+
redirect_to(back_or_index, notice: t('admin.flash.noaction'))
|
119
119
|
end
|
120
120
|
|
121
121
|
def get_collection(model_config, scope, pagination)
|
@@ -32,6 +32,7 @@ module RailsAdmin
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def edit_user_link
|
35
|
+
return nil unless _current_user.respond_to?(:email)
|
35
36
|
return nil unless abstract_model = RailsAdmin.config(_current_user.class).abstract_model
|
36
37
|
return nil unless (edit_action = RailsAdmin::Config::Actions.find(:edit, controller: controller, abstract_model: abstract_model, object: _current_user)).try(:authorized?)
|
37
38
|
link_to _current_user.email, url_for(action: edit_action.action_name, model_name: abstract_model.to_param, id: _current_user.id, controller: 'rails_admin/main')
|
@@ -94,7 +95,7 @@ module RailsAdmin
|
|
94
95
|
url = url_for(action: :index, controller: 'rails_admin/main', model_name: model_param)
|
95
96
|
level_class = " nav-level-#{level}" if level > 0
|
96
97
|
nav_icon = node.navigation_icon ? %(<i class="#{node.navigation_icon}"></i>).html_safe : ''
|
97
|
-
li = content_tag :li,
|
98
|
+
li = content_tag :li, data: {model: model_param} do
|
98
99
|
link_to nav_icon + capitalize_first_letter(node.label_plural), url, class: "pjax#{level_class}"
|
99
100
|
end
|
100
101
|
li + navigation(nodes_stack, nodes_stack.select { |n| n.parent.to_s == node.abstract_model.model_name }, level + 1)
|
@@ -150,7 +151,7 @@ module RailsAdmin
|
|
150
151
|
actions = actions(:bulkable, abstract_model)
|
151
152
|
return '' if actions.empty?
|
152
153
|
content_tag :li, class: 'dropdown', style: 'float:right' do
|
153
|
-
content_tag(:a, class: 'dropdown-toggle', :
|
154
|
+
content_tag(:a, class: 'dropdown-toggle', data: {toggle: 'dropdown'}, href: '#') { t('admin.misc.bulk_menu_title').html_safe + '<b class="caret"></b>'.html_safe } +
|
154
155
|
content_tag(:ul, class: 'dropdown-menu', style: 'left:auto; right:0;') do
|
155
156
|
actions.collect do |action|
|
156
157
|
content_tag :li do
|
@@ -160,5 +161,14 @@ module RailsAdmin
|
|
160
161
|
end
|
161
162
|
end.html_safe
|
162
163
|
end
|
164
|
+
|
165
|
+
def flash_alert_class(flash_key)
|
166
|
+
case flash_key.to_s
|
167
|
+
when 'error' then 'alert-danger'
|
168
|
+
when 'alert' then 'alert-warning'
|
169
|
+
when 'notice' then 'alert-info'
|
170
|
+
else "alert-#{flash_key}"
|
171
|
+
end
|
172
|
+
end
|
163
173
|
end
|
164
174
|
end
|
@@ -63,11 +63,7 @@ module RailsAdmin
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def field_for(field)
|
66
|
-
|
67
|
-
field.pretty_value.to_s.html_safe
|
68
|
-
else
|
69
|
-
field.render
|
70
|
-
end
|
66
|
+
field.read_only? ? @template.content_tag(:div, field.pretty_value, class: 'form-control-static') : field.render
|
71
67
|
end
|
72
68
|
|
73
69
|
def object_infos
|
@@ -16,10 +16,7 @@
|
|
16
16
|
= render "layouts/rails_admin/navigation"
|
17
17
|
.container-fluid
|
18
18
|
.row
|
19
|
-
.col-sm-3.col-md-2.
|
20
|
-
|
21
|
-
%ul.nav.nav-pills.nav-stacked= main_navigation
|
22
|
-
%ul.nav.nav-pills.nav-stacked= static_navigation
|
19
|
+
.col-sm-3.col-md-2.sidebar-nav
|
20
|
+
= render "layouts/rails_admin/sidebar_navigation"
|
23
21
|
.col-sm-9.col-sm-offset-3.col-md-10.col-md-offset-2
|
24
|
-
.
|
25
|
-
.content{:'data-pjax-container' => true}= render template: 'layouts/rails_admin/pjax'
|
22
|
+
.content{:'data-pjax-container' => true}= render template: 'layouts/rails_admin/pjax'
|
@@ -6,8 +6,7 @@
|
|
6
6
|
.page-header
|
7
7
|
%h1= @page_name
|
8
8
|
- flash && flash.each do |key, value|
|
9
|
-
|
10
|
-
.alert{class: "alert-#{key}"}
|
9
|
+
.alert{class: flash_alert_class(key)}
|
11
10
|
%a.close{href: '#', :'data-dismiss' => "alert"} ×
|
12
11
|
= value
|
13
12
|
= breadcrumb
|
@@ -1,2 +1,2 @@
|
|
1
|
-
.
|
2
|
-
= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ value: field.form_value
|
1
|
+
.form-inline
|
2
|
+
= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ value: field.form_value, data: { datetimepicker: true, options: field.js_plugin_options.to_json } })
|
@@ -1 +1 @@
|
|
1
|
-
= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ value: field.form_value,
|
1
|
+
= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ value: field.form_value, class: 'form-control', required: field.required})
|
@@ -0,0 +1,8 @@
|
|
1
|
+
:ruby
|
2
|
+
js_data = {
|
3
|
+
csspath: field.css_location,
|
4
|
+
jspath: field.js_location,
|
5
|
+
config_options: field.config_options.to_json
|
6
|
+
}
|
7
|
+
|
8
|
+
= form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: 'froala-wysiwyg', options: js_data.to_json }).reverse_merge({ value: field.form_value })
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.controls.col-
|
1
|
+
.controls.col-sm-10{data: { nestedmany: true }}
|
2
2
|
.btn-group
|
3
3
|
%a.btn.btn-info.toggler{:'data-toggle' => "button", :'data-target' => "#{form.jquery_namespace(field)} > .tab-content, #{form.jquery_namespace(field)} > .controls > .nav", class: (field.active? ? 'active' : '')}
|
4
4
|
%i.icon-white
|
@@ -6,7 +6,8 @@
|
|
6
6
|
= form.link_to_add "<i class=\"icon-plus icon-white\"></i> #{wording_for(:link, :new, field.associated_model_config.abstract_model)}".html_safe, field.name, { class: 'btn btn-info' }
|
7
7
|
= form.errors_for(field)
|
8
8
|
= form.help_for(field)
|
9
|
-
%ul.nav.nav-tabs
|
9
|
+
%ul.nav.nav-tabs
|
10
|
+
|
10
11
|
.tab-content
|
11
12
|
= form.fields_for field.name do |nested_form|
|
12
13
|
- if field.nested_form[:allow_destroy] || nested_form.options[:child_index] == "new_#{field.name}"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.controls{data: { nestedone: true }}
|
1
|
+
.controls.col-sm-10{data: { nestedone: true }}
|
2
2
|
%ul.nav{style: 'margin-bottom:0px; display:none'}
|
3
3
|
.btn-group
|
4
4
|
%a.btn.btn-info.toggler{:'data-toggle' => "button", :'data-target' => "#{form.jquery_namespace(field)} > .tab-content", class: (field.active? ? 'active' : '') }
|
@@ -6,5 +6,6 @@
|
|
6
6
|
selected = field.bindings[:object].send(field.association.name)
|
7
7
|
column_type_dom_id = form.dom_id(field).sub(field.method_name.to_s, type_column)
|
8
8
|
|
9
|
-
|
10
|
-
= form.select
|
9
|
+
.form-inline
|
10
|
+
= form.select type_column, type_collection, {include_blank: true, selected: selected_type}, class: "form-control", id: column_type_dom_id, data: { polymorphic: true, urls: field.polymorphic_type_urls.to_json }
|
11
|
+
= form.select field.method_name, collection, {include_blank: true, selected: selected.try(:id)}, class: "form-control"
|
@@ -1,8 +1,6 @@
|
|
1
|
-
%input{type: :hidden, name: 'return_to', value: (params[:return_to].presence || request.referer)}
|
2
|
-
%br
|
3
|
-
|
4
1
|
.form-group.form-actions
|
5
2
|
.col-sm-offset-2.col-sm-10
|
3
|
+
%input{type: :hidden, name: 'return_to', value: (params[:return_to].presence || request.referer)}
|
6
4
|
%button.btn.btn-primary{type: "submit", name: "_save", :'data-disable-with' => t("admin.form.save")}
|
7
5
|
%i.icon-white.icon-ok
|
8
6
|
= t("admin.form.save")
|
@@ -13,6 +11,6 @@
|
|
13
11
|
- if authorized? :edit, @abstract_model
|
14
12
|
%button.btn.btn-info{type: "submit", name: "_add_edit", :'data-disable-with' => t("admin.form.save_and_edit")}
|
15
13
|
= t("admin.form.save_and_edit")
|
16
|
-
%button.btn{type: "submit", name: "_continue", :'data-disable-with' => t("admin.form.cancel")}
|
14
|
+
%button.btn{type: "submit", name: "_continue", :'data-disable-with' => t("admin.form.cancel"), :formnovalidate => true}
|
17
15
|
%i.icon-remove
|
18
16
|
= t("admin.form.cancel")
|
@@ -12,7 +12,7 @@
|
|
12
12
|
- index_path = index_path(model_name: abstract_model.to_param)
|
13
13
|
- row_class = "#{cycle("odd", "even")}#{" link" if index_path} #{abstract_model.param_key}_links"
|
14
14
|
%tr{class: row_class, :"data-link" => index_path}
|
15
|
-
- last_used = @most_recent_changes[abstract_model.
|
15
|
+
- last_used = @most_recent_changes[abstract_model.model.name]
|
16
16
|
- active = last_used.try(:today?)
|
17
17
|
%td
|
18
18
|
%span.show= link_to capitalize_first_letter(abstract_model.config.label_plural), index_path, class: 'pjax'
|
@@ -21,11 +21,11 @@
|
|
21
21
|
= time_ago_in_words last_used
|
22
22
|
= t "admin.misc.ago"
|
23
23
|
%td
|
24
|
-
- count = @count[abstract_model.
|
24
|
+
- count = @count[abstract_model.model.name]
|
25
25
|
- percent = count > 0 ? (@max <= 1 ? count : ((Math.log(count+1) * 100.0) / Math.log(@max+1)).to_i) : -1
|
26
26
|
.progress{style: "margin-bottom:0px", class: "progress-#{get_indicator(percent)} #{active && 'active progress-striped'}" }
|
27
27
|
.progress-bar.animate-width-to{:class => "progress-bar-#{get_indicator(percent)}", :'data-animate-length' => ([1.0, percent].max.to_i * 20), :'data-animate-width-to' => "#{[2.0, percent].max.to_i}%", style: "width:2%"}
|
28
|
-
= @count[abstract_model.
|
28
|
+
= @count[abstract_model.model.name]
|
29
29
|
%td.links
|
30
30
|
%ul.inline.list-inline= menu_for :collection, abstract_model, nil, true
|
31
31
|
- if @auditing_adapter && authorized?(:history_index)
|
@@ -23,7 +23,7 @@
|
|
23
23
|
%label.checkbox{for: "schema_#{list}_#{field.method_name}"}
|
24
24
|
= check_box_tag "schema[#{list}][]", field.method_name, true, { id: "schema_#{list}_#{field.method_name}" }
|
25
25
|
= field.label + " [id]"
|
26
|
-
- polymorphic_type_column_name = @abstract_model.properties.
|
26
|
+
- polymorphic_type_column_name = @abstract_model.properties.detect {|p| field.association.foreign_type == p.name }.name
|
27
27
|
%label.checkbox{for: "schema_#{list}_#{polymorphic_type_column_name}"}
|
28
28
|
= check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { id: "schema_#{list}_#{polymorphic_type_column_name}" }
|
29
29
|
= capitalize_first_letter(field.label) + " [type]"
|
@@ -68,16 +68,16 @@
|
|
68
68
|
= select_tag 'csv_options[generator][col_sep]', options_for_select({ '' => t('admin.export.csv.default_col_sep'), "<comma> ','" => ',', "<semicolon> ';'" => ';', '<tabs>' => "'\t'" })
|
69
69
|
%p.help-block= t('admin.export.csv.col_sep_help', value: t('admin.export.csv.default_col_sep'))
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
71
|
+
.form-group.form-actions
|
72
|
+
.col-sm-offset-2.col-sm-10
|
73
|
+
%input{type: :hidden, name: 'return_to', value: (params[:return_to].presence || request.referer)}
|
74
|
+
%button.btn.btn-primary{type: "submit", name: 'csv'}
|
75
|
+
%i.icon-white.icon-ok
|
76
|
+
= t("admin.export.confirmation", name: 'csv')
|
77
|
+
%button.btn.btn-info{type: "submit", name: 'json'}
|
78
|
+
= t("admin.export.confirmation", name: 'json')
|
79
|
+
%button.btn.btn-info{type: "submit", name: 'xml'}
|
80
|
+
= t("admin.export.confirmation", name: 'xml')
|
81
|
+
%button.btn{type: "submit", name: "_continue"}
|
82
|
+
%i.icon-remove
|
83
|
+
= t("admin.form.cancel")
|
data/lib/rails_admin/config.rb
CHANGED
@@ -53,6 +53,9 @@ module RailsAdmin
|
|
53
53
|
# Set the max width of columns in list view before a new set is created
|
54
54
|
attr_accessor :total_columns_width
|
55
55
|
|
56
|
+
# set parent controller
|
57
|
+
attr_accessor :parent_controller
|
58
|
+
|
56
59
|
# Stores model configuration objects in a hash identified by model's class
|
57
60
|
# name.
|
58
61
|
#
|
@@ -270,6 +273,7 @@ module RailsAdmin
|
|
270
273
|
@registry = {}
|
271
274
|
@navigation_static_links = {}
|
272
275
|
@navigation_static_label = nil
|
276
|
+
@parent_controller = '::ApplicationController'
|
273
277
|
RailsAdmin::Config::Actions.reset
|
274
278
|
end
|
275
279
|
|
@@ -302,7 +306,7 @@ module RailsAdmin
|
|
302
306
|
end
|
303
307
|
|
304
308
|
def viable_models
|
305
|
-
included_models.collect(&:to_s).presence ||
|
309
|
+
included_models.collect(&:to_s).presence || begin
|
306
310
|
@@system_models ||= # memoization for tests
|
307
311
|
([Rails.application] + Rails::Engine.subclasses.collect(&:instance)).flat_map do |app|
|
308
312
|
(app.paths['app/models'].to_a + app.config.autoload_paths).collect do |load_path|
|
@@ -314,7 +318,7 @@ module RailsAdmin
|
|
314
318
|
end
|
315
319
|
end
|
316
320
|
end.flatten.reject { |m| m.starts_with?('Concerns::') } # rubocop:disable MultilineBlockChain
|
317
|
-
|
321
|
+
end
|
318
322
|
end
|
319
323
|
|
320
324
|
def visible_models_with_bindings(bindings)
|
@@ -32,7 +32,7 @@ module RailsAdmin
|
|
32
32
|
bindings[:abstract_model].nil? || (
|
33
33
|
(only.nil? || [only].flatten.collect(&:to_s).include?(bindings[:abstract_model].to_s)) &&
|
34
34
|
![except].flatten.collect(&:to_s).include?(bindings[:abstract_model].to_s) &&
|
35
|
-
bindings[:abstract_model].config.
|
35
|
+
!bindings[:abstract_model].config.excluded?
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
@@ -15,27 +15,40 @@ module RailsAdmin
|
|
15
15
|
register_instance_option :controller do
|
16
16
|
proc do
|
17
17
|
if request.post? # BULK DELETE
|
18
|
-
|
19
18
|
@objects = list_entries(@model_config, :destroy)
|
20
19
|
|
21
|
-
|
20
|
+
if @objects.blank?
|
21
|
+
flash[:error] = t('admin.flash.error', name: pluralize(0, @model_config.label), action: t('admin.actions.delete.done'))
|
22
|
+
redirect_to index_path
|
23
|
+
else
|
24
|
+
render @action.template_name
|
25
|
+
end
|
22
26
|
|
23
27
|
elsif request.delete? # BULK DESTROY
|
24
28
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
destroyed = processed_objects.select(&:destroyed?)
|
29
|
-
not_destroyed = processed_objects - destroyed
|
29
|
+
destroyed = nil
|
30
|
+
not_destroyed = nil
|
30
31
|
|
31
|
-
|
32
|
-
@
|
32
|
+
unless params[:bulk_ids].blank?
|
33
|
+
@objects = list_entries(@model_config, :destroy)
|
34
|
+
unless @objects.blank?
|
35
|
+
processed_objects = @abstract_model.destroy(@objects)
|
36
|
+
destroyed = processed_objects.select(&:destroyed?)
|
37
|
+
not_destroyed = processed_objects - destroyed
|
38
|
+
destroyed.each do |object|
|
39
|
+
@auditing_adapter && @auditing_adapter.delete_object(object, @abstract_model, _current_user)
|
40
|
+
end
|
41
|
+
end
|
33
42
|
end
|
34
43
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
44
|
+
if destroyed.nil?
|
45
|
+
msg = t('admin.flash.error', name: pluralize(0, @model_config.label), action: t('admin.actions.delete.done'))
|
46
|
+
render text: msg, status: :not_found
|
47
|
+
else
|
48
|
+
flash[:success] = t('admin.flash.successful', name: pluralize(destroyed.count, @model_config.label), action: t('admin.actions.delete.done')) unless destroyed.empty?
|
49
|
+
flash[:error] = t('admin.flash.error', name: pluralize(not_destroyed.count, @model_config.label), action: t('admin.actions.delete.done')) unless not_destroyed.empty?
|
50
|
+
redirect_to back_or_index
|
51
|
+
end
|
39
52
|
|
40
53
|
end
|
41
54
|
end
|
@@ -25,9 +25,9 @@ module RailsAdmin
|
|
25
25
|
scope = @authorization_adapter && @authorization_adapter.query(:index, t)
|
26
26
|
current_count = t.count({}, scope)
|
27
27
|
@max = current_count > @max ? current_count : @max
|
28
|
-
@count[t.
|
28
|
+
@count[t.model.name] = current_count
|
29
29
|
next unless t.properties.detect { |c| c.name == :updated_at }
|
30
|
-
@most_recent_changes[t.
|
30
|
+
@most_recent_changes[t.model.name] = t.first(sort: "#{t.table_name}.updated_at").try(:updated_at)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
render @action.template_name, status: (flash[:error].present? ? :not_found : 200)
|
@@ -6,7 +6,7 @@ module RailsAdmin
|
|
6
6
|
#
|
7
7
|
# @see RailsAdmin::Config::Fields.registry
|
8
8
|
mattr_reader :default_factory
|
9
|
-
@@default_factory =
|
9
|
+
@@default_factory = proc do |parent, properties, fields|
|
10
10
|
# If it's an association
|
11
11
|
if properties.association?
|
12
12
|
association = parent.abstract_model.associations.detect { |a| a.name.to_s == properties.name.to_s }
|
@@ -174,7 +174,8 @@ module RailsAdmin
|
|
174
174
|
abstract_model.model.validators_on(column_name).detect do |v|
|
175
175
|
!(v.options[:allow_nil] || v.options[:allow_blank]) &&
|
176
176
|
[:presence, :numericality, :attachment_presence].include?(v.kind) &&
|
177
|
-
(v.options[:on] == context || v.options[:on].blank?)
|
177
|
+
(v.options[:on] == context || v.options[:on].blank?) &&
|
178
|
+
(v.options[:if].blank? && v.options[:unless].blank?)
|
178
179
|
end
|
179
180
|
end
|
180
181
|
end
|
@@ -26,5 +26,7 @@ require 'rails_admin/config/fields/types/color'
|
|
26
26
|
require 'rails_admin/config/fields/types/ck_editor'
|
27
27
|
require 'rails_admin/config/fields/types/code_mirror'
|
28
28
|
require 'rails_admin/config/fields/types/wysihtml5'
|
29
|
+
require 'rails_admin/config/fields/types/froala'
|
29
30
|
require 'rails_admin/config/fields/types/json'
|
30
31
|
require 'rails_admin/config/fields/types/inet'
|
32
|
+
require 'rails_admin/config/fields/types/uuid'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rails_admin/config/fields/base'
|
2
|
+
|
3
|
+
module RailsAdmin
|
4
|
+
module Config
|
5
|
+
module Fields
|
6
|
+
module Types
|
7
|
+
class Froala < RailsAdmin::Config::Fields::Types::Text
|
8
|
+
# Register field type for the type loader
|
9
|
+
RailsAdmin::Config::Fields::Types.register(self)
|
10
|
+
|
11
|
+
# If you want to have a different toolbar configuration for wysihtml5
|
12
|
+
# you can use a Ruby hash to configure these options:
|
13
|
+
# https://github.com/jhollingworth/bootstrap-wysihtml5/#advanced
|
14
|
+
register_instance_option :config_options do
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
register_instance_option :css_location do
|
19
|
+
ActionController::Base.helpers.asset_path('froala_editor.min.css')
|
20
|
+
end
|
21
|
+
|
22
|
+
register_instance_option :js_location do
|
23
|
+
ActionController::Base.helpers.asset_path('froala_editor.min.js')
|
24
|
+
end
|
25
|
+
|
26
|
+
register_instance_option :partial do
|
27
|
+
:form_froala
|
28
|
+
end
|
29
|
+
|
30
|
+
[:config_options, :css_location, :js_location].each do |key|
|
31
|
+
register_deprecated_instance_option :"froala_#{key}", key
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails_admin/config/fields/types/string'
|
2
|
+
|
3
|
+
module RailsAdmin
|
4
|
+
module Config
|
5
|
+
module Fields
|
6
|
+
module Types
|
7
|
+
class Uuid < RailsAdmin::Config::Fields::Types::String
|
8
|
+
RailsAdmin::Config::Fields::Types.register(self)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -25,13 +25,13 @@ module RailsAdmin
|
|
25
25
|
else
|
26
26
|
properties = abstract_model.properties.detect { |p| name == p.name }
|
27
27
|
end
|
28
|
-
field = (_fields <<
|
28
|
+
field = (_fields << RailsAdmin::Config::Fields::Types.load(type).new(self, name, properties)).last
|
29
29
|
end
|
30
30
|
|
31
31
|
# If field has not been yet defined add some default properties
|
32
32
|
if add_to_section && !field.defined
|
33
33
|
field.defined = true
|
34
|
-
field.order = _fields.
|
34
|
+
field.order = _fields.count(&:defined)
|
35
35
|
end
|
36
36
|
|
37
37
|
# If a block has been given evaluate it and sort fields after that
|
@@ -51,7 +51,7 @@ module RailsAdmin
|
|
51
51
|
_fields.select { |f| f.instance_eval(&block) }.each do |f|
|
52
52
|
next if f.defined
|
53
53
|
f.defined = true
|
54
|
-
f.order = _fields.
|
54
|
+
f.order = _fields.count(&:defined)
|
55
55
|
end
|
56
56
|
else
|
57
57
|
fields(*field_names, &block)
|
@@ -60,7 +60,7 @@ module RailsAdmin
|
|
60
60
|
|
61
61
|
# exclude fields by name or by condition (block)
|
62
62
|
def exclude_fields(*field_names, &block)
|
63
|
-
block ||=
|
63
|
+
block ||= proc { |f| field_names.include?(f.name) }
|
64
64
|
_fields.each { |f| f.defined = true } if _fields.select(&:defined).empty?
|
65
65
|
_fields.select { |f| f.instance_eval(&block) }.each { |f| f.defined = false }
|
66
66
|
end
|
@@ -91,7 +91,7 @@ module RailsAdmin
|
|
91
91
|
defined.collect do |f|
|
92
92
|
unless f.defined
|
93
93
|
f.defined = true
|
94
|
-
f.order = _fields.
|
94
|
+
f.order = _fields.count(&:defined)
|
95
95
|
end
|
96
96
|
f.instance_eval(&block) if block
|
97
97
|
f
|
@@ -3,7 +3,7 @@ require 'csv'
|
|
3
3
|
|
4
4
|
module RailsAdmin
|
5
5
|
class CSVConverter
|
6
|
-
UTF8_ENCODINGS = [nil, '', 'utf8', 'utf-8', 'unicode', 'UTF8', 'UTF-8', 'UNICODE']
|
6
|
+
UTF8_ENCODINGS = [nil, '', 'utf8', 'utf-8', 'unicode', 'UTF8', 'UTF-8', 'UNICODE', 'utf8mb4']
|
7
7
|
TARGET_ENCODINGS = %w(UTF-8 UTF-16LE UTF-16BE UTF-32LE UTF-32BE UTF-7 ISO-8859-1 ISO-8859-15 IBM850 MacRoman Windows-1252 ISO-8859-3 IBM852 ISO-8859-2 Windows-1250 IBM855 ISO-8859-5 KOI8-R MacCyrillic Windows-1251 IBM866 GB2312 GBK GB18030 Big5 Big5-HKSCS EUC-TW EUC-JP ISO-2022-JP Shift_JIS EUC-KR)
|
8
8
|
def initialize(objects = [], schema = {})
|
9
9
|
return self if (@objects = objects).blank?
|
data/lib/rails_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Michaels-Ober
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-06-12 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: builder
|
@@ -424,10 +424,12 @@ files:
|
|
424
424
|
- app/views/kaminari/twitter-bootstrap/_prev_page.html.haml
|
425
425
|
- app/views/layouts/rails_admin/_navigation.html.haml
|
426
426
|
- app/views/layouts/rails_admin/_secondary_navigation.html.haml
|
427
|
+
- app/views/layouts/rails_admin/_sidebar_navigation.html.haml
|
427
428
|
- app/views/layouts/rails_admin/application.html.haml
|
428
429
|
- app/views/layouts/rails_admin/pjax.html.haml
|
429
430
|
- app/views/rails_admin/main/_dashboard_history.html.haml
|
430
431
|
- app/views/rails_admin/main/_delete_notice.html.haml
|
432
|
+
- app/views/rails_admin/main/_form_boolean.html.haml
|
431
433
|
- app/views/rails_admin/main/_form_ck_editor.html.haml
|
432
434
|
- app/views/rails_admin/main/_form_code_mirror.html.haml
|
433
435
|
- app/views/rails_admin/main/_form_colorpicker.html.haml
|
@@ -437,6 +439,7 @@ files:
|
|
437
439
|
- app/views/rails_admin/main/_form_file_upload.html.haml
|
438
440
|
- app/views/rails_admin/main/_form_filtering_multiselect.html.haml
|
439
441
|
- app/views/rails_admin/main/_form_filtering_select.html.haml
|
442
|
+
- app/views/rails_admin/main/_form_froala.html.haml
|
440
443
|
- app/views/rails_admin/main/_form_nested_many.html.haml
|
441
444
|
- app/views/rails_admin/main/_form_nested_one.html.haml
|
442
445
|
- app/views/rails_admin/main/_form_polymorphic_association.html.haml
|
@@ -517,6 +520,7 @@ files:
|
|
517
520
|
- lib/rails_admin/config/fields/types/enum.rb
|
518
521
|
- lib/rails_admin/config/fields/types/file_upload.rb
|
519
522
|
- lib/rails_admin/config/fields/types/float.rb
|
523
|
+
- lib/rails_admin/config/fields/types/froala.rb
|
520
524
|
- lib/rails_admin/config/fields/types/has_and_belongs_to_many_association.rb
|
521
525
|
- lib/rails_admin/config/fields/types/has_many_association.rb
|
522
526
|
- lib/rails_admin/config/fields/types/has_one_association.rb
|
@@ -532,6 +536,7 @@ files:
|
|
532
536
|
- lib/rails_admin/config/fields/types/text.rb
|
533
537
|
- lib/rails_admin/config/fields/types/time.rb
|
534
538
|
- lib/rails_admin/config/fields/types/timestamp.rb
|
539
|
+
- lib/rails_admin/config/fields/types/uuid.rb
|
535
540
|
- lib/rails_admin/config/fields/types/wysihtml5.rb
|
536
541
|
- lib/rails_admin/config/groupable.rb
|
537
542
|
- lib/rails_admin/config/has_description.rb
|
@@ -588,7 +593,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
588
593
|
version: 1.8.11
|
589
594
|
requirements: []
|
590
595
|
rubyforge_project:
|
591
|
-
rubygems_version: 2.4.
|
596
|
+
rubygems_version: 2.4.5
|
592
597
|
signing_key:
|
593
598
|
specification_version: 4
|
594
599
|
summary: Admin for Rails
|