rails_admin 2.0.0.rc → 2.1.1
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.
- checksums.yaml +4 -4
- data/Gemfile +10 -7
- data/README.md +7 -7
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +38 -16
- data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +7 -7
- data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.js +4 -2
- data/app/assets/javascripts/rails_admin/ra.widgets.js +11 -3
- data/app/controllers/rails_admin/application_controller.rb +2 -0
- data/app/helpers/rails_admin/application_helper.rb +1 -1
- data/app/helpers/rails_admin/form_builder.rb +8 -9
- data/app/helpers/rails_admin/main_helper.rb +2 -1
- data/app/views/rails_admin/main/_form_enumeration.html.haml +4 -3
- data/app/views/rails_admin/main/_form_filtering_multiselect.html.haml +7 -6
- data/app/views/rails_admin/main/index.html.haml +2 -2
- data/app/views/rails_admin/main/show.html.haml +1 -1
- data/config/locales/rails_admin.en.yml +2 -1
- data/lib/rails_admin/abstract_model.rb +2 -2
- data/lib/rails_admin/adapters/active_record.rb +9 -3
- data/lib/rails_admin/adapters/active_record/abstract_object.rb +9 -3
- data/lib/rails_admin/adapters/mongoid/association.rb +1 -1
- data/lib/rails_admin/bootstrap-sass.rb +2 -0
- data/lib/rails_admin/config.rb +1 -5
- data/lib/rails_admin/config/actions/index.rb +1 -1
- data/lib/rails_admin/config/configurable.rb +1 -1
- data/lib/rails_admin/config/fields/base.rb +5 -1
- data/lib/rails_admin/config/fields/types/active_storage.rb +5 -1
- data/lib/rails_admin/config/fields/types/belongs_to_association.rb +4 -0
- data/lib/rails_admin/config/fields/types/file_upload.rb +5 -1
- data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +5 -1
- data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +2 -1
- data/lib/rails_admin/config/fields/types/shrine.rb +13 -11
- data/lib/rails_admin/config/has_groups.rb +1 -1
- data/lib/rails_admin/config/lazy_model.rb +4 -4
- data/lib/rails_admin/config/model.rb +2 -2
- data/lib/rails_admin/config/proxyable/proxy.rb +4 -4
- data/lib/rails_admin/extension.rb +16 -4
- data/lib/rails_admin/extensions/controller_extension.rb +6 -0
- data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +8 -6
- data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +1 -3
- data/lib/rails_admin/support/csv_converter.rb +1 -1
- data/lib/rails_admin/version.rb +3 -3
- data/lib/tasks/rails_admin.rake +16 -7
- data/vendor/assets/javascripts/rails_admin/moment-with-locales.js +9451 -3263
- data/vendor/assets/stylesheets/rails_admin/{font-awesome.css.erb → font-awesome.scss} +3 -3
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e91bcbfc9a80b1718903e12a7a806f295115aab1917a5613632a9ee50a9b7973
|
|
4
|
+
data.tar.gz: 278d75adfbb87dbfc1751f9c510eba68a13809873fce08dc6ed6e53355f0b9c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a8fefb5416435b1e0a7622f6c6fc547b356b8d9e33fc30ea715030a33f4957952a587830a68565c574e50c1b3f6c98327a039accf75389a6d053a03c884be84
|
|
7
|
+
data.tar.gz: 85258795ff168eff5d247eb77cec0a8fd1b630e830eb17b8144914592e3d3fd50808c924248cca101c13a8a21683e75eb5a6407b768d3580bd04daef412b339f
|
data/Gemfile
CHANGED
|
@@ -8,7 +8,7 @@ gem 'devise'
|
|
|
8
8
|
group :active_record do
|
|
9
9
|
gem 'paper_trail'
|
|
10
10
|
|
|
11
|
-
platforms :ruby, :mswin, :mingw do
|
|
11
|
+
platforms :ruby, :mswin, :mingw, :x64_mingw do
|
|
12
12
|
gem 'mysql2', '>= 0.3.14'
|
|
13
13
|
gem 'sqlite3', '>= 1.3'
|
|
14
14
|
end
|
|
@@ -19,29 +19,32 @@ group :development, :test do
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
group :test do
|
|
22
|
+
gem 'cancancan', '~> 3.0'
|
|
22
23
|
gem 'carrierwave', ['>= 2.0.0.rc', '< 3']
|
|
23
|
-
gem '
|
|
24
|
-
gem 'database_cleaner', ['>= 1.2', '!= 1.4.0', '!= 1.5.0']
|
|
24
|
+
gem 'database_cleaner', ['>= 1.2', '!= 1.4.0', '!= 1.5.0', '< 2.0']
|
|
25
25
|
gem 'dragonfly', '~> 1.0'
|
|
26
26
|
gem 'factory_bot', '>= 4.2'
|
|
27
27
|
gem 'generator_spec', '>= 0.8'
|
|
28
28
|
gem 'launchy', '>= 2.2'
|
|
29
29
|
gem 'mini_magick', '>= 3.4'
|
|
30
|
-
gem 'paperclip', ['>= 3.4', '!= 4.3.0']
|
|
31
30
|
gem 'poltergeist', '~> 1.5'
|
|
32
31
|
gem 'pundit'
|
|
33
32
|
gem 'rack-cache', require: 'rack/cache'
|
|
34
33
|
gem 'rspec-rails', '>= 2.14'
|
|
35
34
|
gem 'rspec-expectations', '!= 3.8.3'
|
|
36
|
-
gem '
|
|
35
|
+
gem 'rspec-retry'
|
|
36
|
+
gem 'rubocop', '~> 0.68.1', require: false
|
|
37
|
+
gem 'rubocop-performance', require: false
|
|
37
38
|
gem 'simplecov', '>= 0.9', require: false
|
|
38
|
-
gem '
|
|
39
|
-
gem 'shrine-memory'
|
|
39
|
+
gem 'simplecov-lcov', require: false
|
|
40
40
|
gem 'timecop', '>= 0.5'
|
|
41
41
|
|
|
42
42
|
platforms :ruby_19 do
|
|
43
43
|
gem 'tins', '~> 1.6.0', require: false
|
|
44
44
|
end
|
|
45
|
+
|
|
46
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
47
|
+
gem 'tzinfo-data', platforms: %i(mingw mswin x64_mingw jruby)
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
gemspec
|
data/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# RailsAdmin
|
|
2
2
|
|
|
3
3
|
[][gem]
|
|
4
|
-
[][ghactions]
|
|
5
5
|
[][coveralls]
|
|
6
6
|
[][inch]
|
|
7
7
|
[][codeclimate]
|
|
8
8
|
[][semver]
|
|
9
9
|
|
|
10
10
|
[gem]: https://rubygems.org/gems/rails_admin
|
|
11
|
-
[
|
|
11
|
+
[ghactions]: https://github.com/sferik/rails_admin/actions
|
|
12
12
|
[coveralls]: https://coveralls.io/r/sferik/rails_admin
|
|
13
13
|
[inch]: http://inch-ci.org/github/sferik/rails_admin
|
|
14
14
|
[codeclimate]: https://codeclimate.com/github/sferik/rails_admin
|
|
@@ -20,9 +20,7 @@ RailsAdmin is a Rails engine that provides an easy-to-use interface for managing
|
|
|
20
20
|
|
|
21
21
|
### [Action required] Security issue
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
>
|
|
25
|
-
> Also, 1.0.0 and 1.1.0 is known to have [CSRF vulnerability](https://github.com/sferik/rails_admin/commit/b13e879eb93b661204e9fb5e55f7afa4f397537a), too.
|
|
23
|
+
**RailsAdmin 2.0.1, 2.0.0 and up to 1.4.2 have been reported to have XSS vulnerability.** We strongly recommend that you upgrade RailsAdmin to 2.0.2 (and higher) or 1.4.3 as soon as possible, if you are on those versions. See [d72090ec](https://github.com/sferik/rails_admin/commit/d72090ec6a07c3b9b7b48ab50f3d405f91ff4375) for the detail.
|
|
26
24
|
|
|
27
25
|
## Getting started
|
|
28
26
|
|
|
@@ -50,7 +48,7 @@ RailsAdmin is a Rails engine that provides an easy-to-use interface for managing
|
|
|
50
48
|
|
|
51
49
|
## Installation
|
|
52
50
|
|
|
53
|
-
1. On your gemfile: `gem 'rails_admin', '~> 2.0
|
|
51
|
+
1. On your gemfile: `gem 'rails_admin', '~> 2.0'`
|
|
54
52
|
2. Run `bundle install`
|
|
55
53
|
3. Run `rails g rails_admin:install`
|
|
56
54
|
4. Provide a namespace for the routes when asked
|
|
@@ -94,13 +92,15 @@ list][list].
|
|
|
94
92
|
If you think you found a bug in RailsAdmin, you can [submit an issue](https://github.com/sferik/rails_admin/issues/new).
|
|
95
93
|
|
|
96
94
|
## Supported Ruby Versions
|
|
97
|
-
This library aims to support and is [tested against][
|
|
95
|
+
This library aims to support and is [tested against][ghactions] the following Ruby implementations:
|
|
98
96
|
|
|
99
97
|
* Ruby 2.2
|
|
100
98
|
* Ruby 2.3
|
|
101
99
|
* Ruby 2.4
|
|
102
100
|
* Ruby 2.5
|
|
103
101
|
* Ruby 2.6
|
|
102
|
+
* Ruby 2.7
|
|
103
|
+
* Ruby 3.0
|
|
104
104
|
* [JRuby][]
|
|
105
105
|
|
|
106
106
|
[jruby]: http://jruby.org/
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
var field_value = options['value'];
|
|
12
12
|
var field_operator = options['operator'];
|
|
13
13
|
var select_options = options['select_options'];
|
|
14
|
+
var required = options['required'];
|
|
14
15
|
var index = options['index'];
|
|
15
16
|
var value_name = 'f[' + field_name + '][' + index + '][v]';
|
|
16
17
|
var operator_name = 'f[' + field_name + '][' + index + '][o]';
|
|
@@ -24,9 +25,13 @@
|
|
|
24
25
|
.append('<option value="_discard">...</option>')
|
|
25
26
|
.append($('<option value="true"></option>').prop('selected', field_value == "true").text(RailsAdmin.I18n.t("true")))
|
|
26
27
|
.append($('<option value="false"></option>').prop('selected', field_value == "false").text(RailsAdmin.I18n.t("false")))
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
if (!required) {
|
|
29
|
+
control.append([
|
|
30
|
+
'<option disabled="disabled">---------</option>',
|
|
31
|
+
$('<option value="_present"></option>').prop('selected', field_value == "_present").text(RailsAdmin.I18n.t("is_present")),
|
|
32
|
+
$('<option value="_blank"></option>').prop('selected', field_value == "_blank").text(RailsAdmin.I18n.t("is_blank"))
|
|
33
|
+
])
|
|
34
|
+
}
|
|
30
35
|
break;
|
|
31
36
|
case 'date':
|
|
32
37
|
additional_control =
|
|
@@ -56,9 +61,13 @@
|
|
|
56
61
|
.append($('<option value="yesterday"></option>').prop('selected', field_operator == "yesterday").text(RailsAdmin.I18n.t("yesterday")))
|
|
57
62
|
.append($('<option value="this_week"></option>').prop('selected', field_operator == "this_week").text(RailsAdmin.I18n.t("this_week")))
|
|
58
63
|
.append($('<option value="last_week"></option>').prop('selected', field_operator == "last_week").text(RailsAdmin.I18n.t("last_week")))
|
|
59
|
-
|
|
60
|
-
.append(
|
|
61
|
-
|
|
64
|
+
if (!required) {
|
|
65
|
+
control.append([
|
|
66
|
+
'<option disabled="disabled">---------</option>',
|
|
67
|
+
$('<option value="_not_null"></option>').prop('selected', field_operator == "_not_null").text(RailsAdmin.I18n.t("is_present")),
|
|
68
|
+
$('<option value="_null"></option>').prop('selected', field_operator == "_null").text(RailsAdmin.I18n.t("is_blank"))
|
|
69
|
+
])
|
|
70
|
+
}
|
|
62
71
|
additional_control = additional_control ||
|
|
63
72
|
$('<input size="25" class="datetime additional-fieldset default input-sm form-control" type="text" />')
|
|
64
73
|
.css('display', (!field_operator || field_operator == "default") ? 'inline-block' : 'none')
|
|
@@ -84,10 +93,14 @@
|
|
|
84
93
|
.prop('name', multiple_values ? undefined : value_name)
|
|
85
94
|
.data('name', value_name)
|
|
86
95
|
.append('<option value="_discard">...</option>')
|
|
87
|
-
|
|
88
|
-
.append(
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
if (!required) {
|
|
97
|
+
control.append([
|
|
98
|
+
$('<option value="_present"></option>').prop('selected', field_value == "_present").text(RailsAdmin.I18n.t("is_present")),
|
|
99
|
+
$('<option value="_blank"></option>').prop('selected', field_value == "_blank").text(RailsAdmin.I18n.t("is_blank")),
|
|
100
|
+
'<option disabled="disabled">---------</option>'
|
|
101
|
+
])
|
|
102
|
+
}
|
|
103
|
+
control.append(select_options)
|
|
91
104
|
.add(
|
|
92
105
|
$('<select multiple="multiple" class="select-multiple input-sm form-control"></select>')
|
|
93
106
|
.css('display', multiple_values ? 'inline-block' : 'none')
|
|
@@ -111,9 +124,13 @@
|
|
|
111
124
|
.append($('<option data-additional-fieldset="additional-fieldset" value="is"></option>').prop('selected', field_operator == "is").text(RailsAdmin.I18n.t("is_exactly")))
|
|
112
125
|
.append($('<option data-additional-fieldset="additional-fieldset" value="starts_with"></option>').prop('selected', field_operator == "starts_with").text(RailsAdmin.I18n.t("starts_with")))
|
|
113
126
|
.append($('<option data-additional-fieldset="additional-fieldset" value="ends_with"></option>').prop('selected', field_operator == "ends_with").text(RailsAdmin.I18n.t("ends_with")))
|
|
114
|
-
|
|
115
|
-
.append(
|
|
116
|
-
|
|
127
|
+
if (!required) {
|
|
128
|
+
control.append([
|
|
129
|
+
'<option disabled="disabled">---------</option>',
|
|
130
|
+
$('<option value="_present"></option>').prop('selected', field_operator == "_present").text(RailsAdmin.I18n.t("is_present")),
|
|
131
|
+
$('<option value="_blank"></option>').prop('selected', field_operator == "_blank").text(RailsAdmin.I18n.t("is_blank"))
|
|
132
|
+
])
|
|
133
|
+
}
|
|
117
134
|
additional_control = $('<input class="additional-fieldset input-sm form-control" type="text" />')
|
|
118
135
|
.css('display', field_operator == "_present" || field_operator == "_blank" ? 'none' : 'inline-block')
|
|
119
136
|
.prop('name', value_name)
|
|
@@ -126,9 +143,13 @@
|
|
|
126
143
|
.prop('name', operator_name)
|
|
127
144
|
.append($('<option data-additional-fieldset="default" value="default"></option>').prop('selected', field_operator == "default").text(RailsAdmin.I18n.t("number")))
|
|
128
145
|
.append($('<option data-additional-fieldset="between" value="between"></option>').prop('selected', field_operator == "between").text(RailsAdmin.I18n.t("between_and_")))
|
|
129
|
-
|
|
130
|
-
.append(
|
|
131
|
-
|
|
146
|
+
if (!required) {
|
|
147
|
+
control.append([
|
|
148
|
+
'<option disabled="disabled">---------</option>',
|
|
149
|
+
$('<option value="_not_null"></option>').prop('selected', field_operator == "_not_null").text(RailsAdmin.I18n.t("is_present")),
|
|
150
|
+
$('<option value="_null"></option>').prop('selected', field_operator == "_null").text(RailsAdmin.I18n.t("is_blank"))
|
|
151
|
+
])
|
|
152
|
+
}
|
|
132
153
|
additional_control =
|
|
133
154
|
$('<input class="additional-fieldset default input-sm form-control" type="text" />')
|
|
134
155
|
.css('display', (!field_operator || field_operator == "default") ? 'inline-block' : 'none')
|
|
@@ -193,6 +214,7 @@
|
|
|
193
214
|
value: $(this).data('field-value'),
|
|
194
215
|
operator: $(this).data('field-operator'),
|
|
195
216
|
select_options: $(this).data('field-options'),
|
|
217
|
+
required: $(this).data('field-required'),
|
|
196
218
|
index: $.now().toString().slice(6,11),
|
|
197
219
|
datetimepicker_format: $(this).data('field-datetimepicker-format')
|
|
198
220
|
});
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
sortable: false,
|
|
20
20
|
removable: true,
|
|
21
21
|
regional: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
add: 'Add',
|
|
23
|
+
chooseAll: 'Choose all',
|
|
24
|
+
clearAll: 'Clear all',
|
|
25
|
+
down: 'Down',
|
|
26
|
+
remove: 'Remove',
|
|
27
|
+
search: 'Search',
|
|
28
|
+
up: 'Up'
|
|
29
29
|
},
|
|
30
30
|
searchDelay: 400,
|
|
31
31
|
remote_source: null,
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
$(document).on('nested:fieldAdded', 'form', function(content) {
|
|
12
12
|
var controls, field, nav, new_tab, one_to_one, parent_group, toggler;
|
|
13
13
|
field = content.field.addClass('tab-pane').attr('id', 'unique-id-' + (new Date().getTime()));
|
|
14
|
-
new_tab = $('<li
|
|
14
|
+
new_tab = $('<li></li>').append(
|
|
15
|
+
$('<a></a>').attr('data-toggle', 'tab').attr('href', '#' + field.attr('id')).text(field.children('.object-infos').data('object-label'))
|
|
16
|
+
)
|
|
15
17
|
parent_group = field.closest('.control-group');
|
|
16
18
|
controls = parent_group.children('.controls');
|
|
17
19
|
one_to_one = controls.data('nestedone') !== void 0;
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
content.select(':hidden').show('slow');
|
|
28
30
|
toggler.addClass('active').removeClass('disabled').children('i').addClass('icon-chevron-down').removeClass('icon-chevron-right');
|
|
29
31
|
if (one_to_one) {
|
|
30
|
-
controls.find('.add_nested_fields').removeClass('add_nested_fields').
|
|
32
|
+
controls.find('.add_nested_fields').removeClass('add_nested_fields').text(field.children('.object-infos').data('object-label'));
|
|
31
33
|
}
|
|
32
34
|
});
|
|
33
35
|
|
|
@@ -137,7 +137,11 @@
|
|
|
137
137
|
toggler = field.find('> .controls > .btn-group > .toggler');
|
|
138
138
|
tab_content.children('.fields:not(.tab-pane)').addClass('tab-pane').each(function() {
|
|
139
139
|
$(this).attr('id', 'unique-id-' + (new Date().getTime()) + Math.floor(Math.random() * 100000));
|
|
140
|
-
nav.append(
|
|
140
|
+
nav.append(
|
|
141
|
+
$('<li></li>').append(
|
|
142
|
+
$('<a></a>').attr('data-toggle', 'tab').attr('href', '#' + this.id).text($(this).children('.object-infos').data('object-label'))
|
|
143
|
+
)
|
|
144
|
+
);
|
|
141
145
|
});
|
|
142
146
|
if (nav.find("> li.active").length === 0) {
|
|
143
147
|
nav.find("> li > a[data-toggle='tab']:first").tab('show');
|
|
@@ -165,8 +169,12 @@
|
|
|
165
169
|
tab_content = field.find("> .tab-content");
|
|
166
170
|
toggler = field.find('> .controls > .btn-group > .toggler');
|
|
167
171
|
tab_content.children(".fields:not(.tab-pane)").addClass('tab-pane active').each(function() {
|
|
168
|
-
field.find('> .controls .add_nested_fields').removeClass('add_nested_fields').
|
|
169
|
-
nav.append(
|
|
172
|
+
field.find('> .controls .add_nested_fields').removeClass('add_nested_fields').text($(this).children('.object-infos').data('object-label'));
|
|
173
|
+
nav.append(
|
|
174
|
+
$('<li></li>').append(
|
|
175
|
+
$('<a></a>').attr('data-toggle', 'tab').attr('href', '#' + this.id).text($(this).children('.object-infos').data('object-label'))
|
|
176
|
+
)
|
|
177
|
+
);
|
|
170
178
|
});
|
|
171
179
|
first_tab = nav.find("> li > a[data-toggle='tab']:first");
|
|
172
180
|
first_tab.tab('show');
|
|
@@ -125,7 +125,7 @@ module RailsAdmin
|
|
|
125
125
|
def breadcrumb(action = @action, _acc = [])
|
|
126
126
|
begin
|
|
127
127
|
(parent_actions ||= []) << action
|
|
128
|
-
end while action.breadcrumb_parent && (action = action(*action.breadcrumb_parent)) # rubocop:disable Loop
|
|
128
|
+
end while action.breadcrumb_parent && (action = action(*action.breadcrumb_parent)) # rubocop:disable Lint/Loop
|
|
129
129
|
|
|
130
130
|
content_tag(:ol, class: 'breadcrumb') do
|
|
131
131
|
parent_actions.collect do |a|
|
|
@@ -38,16 +38,15 @@ module RailsAdmin
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def field_wrapper_for(field, nested_in)
|
|
41
|
-
if
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
# do not show nested field if the target is the origin
|
|
42
|
+
return if nested_field_association?(field, nested_in)
|
|
43
|
+
@template.content_tag(:div, class: "form-group control-group #{field.type_css_class} #{field.css_class} #{'error' if field.errors.present?}", id: "#{dom_id(field)}_field") do
|
|
44
|
+
if field.label
|
|
45
|
+
label(field.method_name, capitalize_first_letter(field.label), class: 'col-sm-2 control-label') +
|
|
46
|
+
(field.nested_form ? field_for(field) : input_for(field))
|
|
47
|
+
else
|
|
48
|
+
field.nested_form ? field_for(field) : input_for(field)
|
|
48
49
|
end
|
|
49
|
-
else
|
|
50
|
-
field.nested_form ? field_for(field) : input_for(field)
|
|
51
50
|
end
|
|
52
51
|
end
|
|
53
52
|
|
|
@@ -76,7 +76,8 @@ module RailsAdmin
|
|
|
76
76
|
options[:type] = field.type
|
|
77
77
|
options[:value] = filter_hash['v']
|
|
78
78
|
options[:label] = field.label
|
|
79
|
-
options[:operator] = filter_hash['o']
|
|
79
|
+
options[:operator] = filter_hash['o'] || field.default_filter_operator
|
|
80
|
+
options[:required] = field.required
|
|
80
81
|
options
|
|
81
82
|
end if ordered_filters
|
|
82
83
|
end
|
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
sortable: false,
|
|
8
8
|
cacheAll: true,
|
|
9
9
|
regional: {
|
|
10
|
+
add: t("admin.misc.add_new"),
|
|
10
11
|
chooseAll: t("admin.misc.chose_all"),
|
|
11
|
-
chosen: t("admin.misc.chosen", name: config.label_plural),
|
|
12
12
|
clearAll: t("admin.misc.clear_all"),
|
|
13
|
+
down: t("admin.misc.down"),
|
|
14
|
+
remove: t("admin.misc.remove"),
|
|
13
15
|
search: t("admin.misc.search"),
|
|
14
|
-
up: t("admin.misc.up")
|
|
15
|
-
down: t("admin.misc.down")
|
|
16
|
+
up: t("admin.misc.up")
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
= form.select field.method_name, field.enum, { selected: field.form_value, object: form.object }, field.html_attributes.reverse_merge({data: { filteringmultiselect: true, options: js_data.to_json }, multiple: true})
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
removable: !!field.removable,
|
|
30
30
|
cacheAll: !!field.associated_collection_cache_all,
|
|
31
31
|
regional: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
clearAll: t(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
add: t('admin.misc.add_new'),
|
|
33
|
+
chooseAll: t('admin.misc.chose_all'),
|
|
34
|
+
clearAll: t('admin.misc.clear_all'),
|
|
35
|
+
down: t('admin.misc.down'),
|
|
36
|
+
remove: t('admin.misc.remove'),
|
|
37
|
+
search: t('admin.misc.search'),
|
|
38
|
+
up: t('admin.misc.up')
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
- else
|
|
36
36
|
- ''
|
|
37
37
|
%li
|
|
38
|
-
%a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => "", :"data-field-datetimepicker-format" => (field.try(:parser) && field.parser.to_momentjs)}= capitalize_first_letter(field.label)
|
|
38
|
+
%a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-operator" => field.default_filter_operator, :"data-field-options" => field_options.html_safe, :"data-field-required" => field.required.to_s, :"data-field-type" => field.type, :"data-field-value" => "", :"data-field-datetimepicker-format" => (field.try(:parser) && field.parser.to_momentjs)}= capitalize_first_letter(field.label)
|
|
39
39
|
|
|
40
40
|
%style
|
|
41
41
|
- properties.select{ |p| p.column_width.present? }.each do |property|
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
%button.btn.btn-primary{type: 'submit', :'data-disable-with' => '<i class="icon-white icon-refresh"></i> '.html_safe + t('admin.misc.refresh')}
|
|
54
54
|
%i.icon-white.icon-refresh
|
|
55
55
|
= t('admin.misc.refresh')
|
|
56
|
-
%button#remove_filter.btn.btn-info{title:
|
|
56
|
+
%button#remove_filter.btn.btn-info{title: t('admin.misc.reset_filters')}
|
|
57
57
|
%i.icon-white.icon-remove
|
|
58
58
|
- if export_action
|
|
59
59
|
%span{style: 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), class: 'btn btn-info'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
- @model_config.show.with(object: @object, view: self, controller: self.controller).visible_groups.each do |fieldset|
|
|
2
2
|
- unless (fields = fieldset.with(object: @object, view: self, controller: self.controller).visible_fields).empty?
|
|
3
|
-
- unless (fields = fields.reject{ |f| RailsAdmin::config.compact_show_view && f.formatted_value.nil? || f.formatted_value == '' }).empty?
|
|
3
|
+
- unless (fields = fields.reject{ |f| RailsAdmin::config.compact_show_view && (f.formatted_value.nil? || f.formatted_value == '') }).empty?
|
|
4
4
|
.fieldset
|
|
5
5
|
%h4
|
|
6
6
|
= fieldset.label
|
|
@@ -29,13 +29,13 @@ en:
|
|
|
29
29
|
misc:
|
|
30
30
|
search: "Search"
|
|
31
31
|
filter: "Filter"
|
|
32
|
+
reset_filters: "Reset filters"
|
|
32
33
|
refresh: "Refresh"
|
|
33
34
|
show_all: "Show all"
|
|
34
35
|
add_filter: "Add filter"
|
|
35
36
|
bulk_menu_title: "Selected items"
|
|
36
37
|
remove: "Remove"
|
|
37
38
|
add_new: "Add new"
|
|
38
|
-
chosen: "Chosen %{name}"
|
|
39
39
|
chose_all: "Choose all"
|
|
40
40
|
clear_all: "Clear all"
|
|
41
41
|
up: "Up"
|
|
@@ -45,6 +45,7 @@ en:
|
|
|
45
45
|
navigation_static_label: "Links"
|
|
46
46
|
log_out: "Log out"
|
|
47
47
|
time_ago: "%{time} ago"
|
|
48
|
+
ago: "ago"
|
|
48
49
|
more: "Plus %{count} more %{models_name}"
|
|
49
50
|
flash:
|
|
50
51
|
successful: "%{name} successfully %{action}"
|
|
@@ -178,8 +178,8 @@ module RailsAdmin
|
|
|
178
178
|
|
|
179
179
|
def build_statement_for_datetime_or_timestamp
|
|
180
180
|
start_date, end_date = get_filtering_duration
|
|
181
|
-
start_date = start_date.
|
|
182
|
-
end_date = end_date.
|
|
181
|
+
start_date = start_date.try(:beginning_of_day) if start_date
|
|
182
|
+
end_date = end_date.try(:end_of_day) if end_date
|
|
183
183
|
range_filter(start_date, end_date)
|
|
184
184
|
end
|
|
185
185
|
|
|
@@ -71,11 +71,17 @@ module RailsAdmin
|
|
|
71
71
|
delegate :primary_key, :table_name, to: :model, prefix: false
|
|
72
72
|
|
|
73
73
|
def encoding
|
|
74
|
-
|
|
74
|
+
adapter =
|
|
75
|
+
if ::ActiveRecord::Base.respond_to?(:connection_db_config)
|
|
76
|
+
::ActiveRecord::Base.connection_db_config.configuration_hash[:adapter]
|
|
77
|
+
else
|
|
78
|
+
::ActiveRecord::Base.connection_config[:adapter]
|
|
79
|
+
end
|
|
80
|
+
case adapter
|
|
75
81
|
when 'postgresql'
|
|
76
82
|
::ActiveRecord::Base.connection.select_one("SELECT ''::text AS str;").values.first.encoding
|
|
77
83
|
when 'mysql2'
|
|
78
|
-
::ActiveRecord::Base.connection.
|
|
84
|
+
::ActiveRecord::Base.connection.raw_connection.encoding
|
|
79
85
|
when 'oracle_enhanced'
|
|
80
86
|
::ActiveRecord::Base.connection.select_one("SELECT dummy FROM DUAL").values.first.encoding
|
|
81
87
|
else
|
|
@@ -144,7 +150,7 @@ module RailsAdmin
|
|
|
144
150
|
field = fields.detect { |f| f.name.to_s == field_name }
|
|
145
151
|
value = parse_field_value(field, filter_dump[:v])
|
|
146
152
|
|
|
147
|
-
wb.add(field, value, (filter_dump[:o] ||
|
|
153
|
+
wb.add(field, value, (filter_dump[:o] || RailsAdmin::Config.default_search_operator))
|
|
148
154
|
# AND current filter statements to other filter statements
|
|
149
155
|
scope = wb.build
|
|
150
156
|
end
|