rails_admin 2.0.2 → 2.1.0
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 +5 -7
- data/README.md +4 -3
- 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/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 +1 -1
- data/config/locales/rails_admin.en.yml +0 -1
- data/lib/rails_admin/adapters/active_record.rb +8 -2
- data/lib/rails_admin/adapters/active_record/abstract_object.rb +1 -1
- data/lib/rails_admin/config.rb +0 -4
- data/lib/rails_admin/config/fields/base.rb +4 -0
- data/lib/rails_admin/config/fields/types/active_storage.rb +5 -1
- 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/version.rb +2 -2
- data/lib/tasks/rails_admin.rake +16 -7
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6580d80d2b5212de63e6324b4a11ce681fff331b44c443496e97ba42bdde7dfd
|
4
|
+
data.tar.gz: 3e5a0a86e8925d046fdc04ff6271fae2a04bceb88d745912da09a9b2fac9e32e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: def3648da6a0cdea8194b363f00f0a667cf44561b90d0a7f6afefd2b970db293e712fc34d5fc632402078b338e981409b034d3a7bde5c22c049a55a34587d469
|
7
|
+
data.tar.gz: a5a101d26309d3a77d0f6f56375914ac914833a677bc3d5689229a5bf7d9ad662572c8ddda10d5dcad9fe827a30c7556e143e5022a1d38d821eb755ceb8ae3eb
|
data/Gemfile
CHANGED
@@ -21,24 +21,22 @@ end
|
|
21
21
|
group :test do
|
22
22
|
gem 'cancancan', '~> 3.0'
|
23
23
|
gem 'carrierwave', ['>= 2.0.0.rc', '< 3']
|
24
|
-
gem '
|
25
|
-
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']
|
26
25
|
gem 'dragonfly', '~> 1.0'
|
27
26
|
gem 'factory_bot', '>= 4.2'
|
28
27
|
gem 'generator_spec', '>= 0.8'
|
29
28
|
gem 'launchy', '>= 2.2'
|
30
29
|
gem 'mini_magick', '>= 3.4'
|
31
|
-
gem 'paperclip', ['>= 3.4', '!= 4.3.0']
|
32
30
|
gem 'poltergeist', '~> 1.5'
|
33
31
|
gem 'pundit'
|
34
32
|
gem 'rack-cache', require: 'rack/cache'
|
35
33
|
gem 'rspec-rails', '>= 2.14'
|
36
34
|
gem 'rspec-expectations', '!= 3.8.3'
|
37
|
-
gem '
|
38
|
-
gem 'rubocop
|
35
|
+
gem 'rspec-retry'
|
36
|
+
gem 'rubocop', '~> 0.68.1', require: false
|
37
|
+
gem 'rubocop-performance', require: false
|
39
38
|
gem 'simplecov', '>= 0.9', require: false
|
40
|
-
gem '
|
41
|
-
gem 'shrine-memory'
|
39
|
+
gem 'simplecov-lcov', require: false
|
42
40
|
gem 'timecop', '>= 0.5'
|
43
41
|
|
44
42
|
platforms :ruby_19 do
|
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
|
@@ -92,7 +92,7 @@ list][list].
|
|
92
92
|
If you think you found a bug in RailsAdmin, you can [submit an issue](https://github.com/sferik/rails_admin/issues/new).
|
93
93
|
|
94
94
|
## Supported Ruby Versions
|
95
|
-
This library aims to support and is [tested against][
|
95
|
+
This library aims to support and is [tested against][ghactions] the following Ruby implementations:
|
96
96
|
|
97
97
|
* Ruby 2.2
|
98
98
|
* Ruby 2.3
|
@@ -100,6 +100,7 @@ This library aims to support and is [tested against][travis] the following Ruby
|
|
100
100
|
* Ruby 2.5
|
101
101
|
* Ruby 2.6
|
102
102
|
* Ruby 2.7
|
103
|
+
* Ruby 3.0
|
103
104
|
* [JRuby][]
|
104
105
|
|
105
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,
|
@@ -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|
|
@@ -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
|
data/lib/rails_admin/config.rb
CHANGED
@@ -82,9 +82,6 @@ module RailsAdmin
|
|
82
82
|
attr_accessor :navigation_static_links
|
83
83
|
attr_accessor :navigation_static_label
|
84
84
|
|
85
|
-
# yell about fields that are not marked as accessible
|
86
|
-
attr_accessor :yell_for_non_accessible_fields
|
87
|
-
|
88
85
|
# Setup authentication to be run as a before filter
|
89
86
|
# This is run inside the controller instance so you can setup any authentication you need to
|
90
87
|
#
|
@@ -271,7 +268,6 @@ module RailsAdmin
|
|
271
268
|
def reset
|
272
269
|
@compact_show_view = true
|
273
270
|
@browser_validations = true
|
274
|
-
@yell_for_non_accessible_fields = true
|
275
271
|
@authenticate = nil
|
276
272
|
@authorize = nil
|
277
273
|
@audit = nil
|
@@ -227,6 +227,10 @@ module RailsAdmin
|
|
227
227
|
bindings[:view].render partial: "rails_admin/main/#{partial}", locals: {field: self, form: bindings[:form]}
|
228
228
|
end
|
229
229
|
|
230
|
+
register_instance_option :default_filter_operator do
|
231
|
+
nil
|
232
|
+
end
|
233
|
+
|
230
234
|
def editable?
|
231
235
|
!(@properties && @properties.read_only?)
|
232
236
|
end
|
@@ -8,7 +8,11 @@ module RailsAdmin
|
|
8
8
|
RailsAdmin::Config::Fields::Types.register(self)
|
9
9
|
|
10
10
|
register_instance_option :thumb_method do
|
11
|
-
|
11
|
+
if ::ActiveStorage::VERSION::MAJOR >= 6
|
12
|
+
{resize_to_limit: [100, 100]}
|
13
|
+
else
|
14
|
+
{resize: '100x100>'}
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
register_instance_option :delete_method do
|
@@ -31,6 +31,10 @@ module RailsAdmin
|
|
31
31
|
resource_url.to_s
|
32
32
|
end
|
33
33
|
|
34
|
+
register_instance_option :link_name do
|
35
|
+
value
|
36
|
+
end
|
37
|
+
|
34
38
|
register_instance_option :pretty_value do
|
35
39
|
if value.presence
|
36
40
|
v = bindings[:view]
|
@@ -40,7 +44,7 @@ module RailsAdmin
|
|
40
44
|
image_html = v.image_tag(thumb_url, class: 'img-thumbnail')
|
41
45
|
url != thumb_url ? v.link_to(image_html, url, target: '_blank', rel: 'noopener noreferrer') : image_html
|
42
46
|
else
|
43
|
-
v.link_to(
|
47
|
+
v.link_to(link_name, url, target: '_blank', rel: 'noopener noreferrer')
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|
@@ -9,7 +9,11 @@ module RailsAdmin
|
|
9
9
|
|
10
10
|
class ActiveStorageAttachment < RailsAdmin::Config::Fields::Types::MultipleFileUpload::AbstractAttachment
|
11
11
|
register_instance_option :thumb_method do
|
12
|
-
|
12
|
+
if ::ActiveStorage::VERSION::MAJOR >= 6
|
13
|
+
{resize_to_limit: [100, 100]}
|
14
|
+
else
|
15
|
+
{resize: '100x100>'}
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
register_instance_option :delete_value do
|
@@ -38,7 +38,8 @@ module RailsAdmin
|
|
38
38
|
image_html = v.image_tag(thumb_url, class: 'img-thumbnail')
|
39
39
|
url != thumb_url ? v.link_to(image_html, url, target: '_blank', rel: 'noopener noreferrer') : image_html
|
40
40
|
else
|
41
|
-
|
41
|
+
display_value = value.respond_to?(:filename) ? value.filename : value
|
42
|
+
v.link_to(display_value, url, target: '_blank', rel: 'noopener noreferrer')
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
@@ -10,14 +10,16 @@ module RailsAdmin
|
|
10
10
|
register_instance_option :thumb_method do
|
11
11
|
unless defined? @thumb_method
|
12
12
|
@thumb_method = begin
|
13
|
-
next nil unless
|
13
|
+
next nil unless bindings[:object].respond_to?("#{name}_derivatives")
|
14
14
|
|
15
|
-
|
15
|
+
derivatives = bindings[:object].public_send("#{name}_derivatives")
|
16
|
+
|
17
|
+
if derivatives.key?(:thumb)
|
16
18
|
:thumb
|
17
|
-
elsif
|
19
|
+
elsif derivatives.key?(:thumbnail)
|
18
20
|
:thumbnail
|
19
21
|
else
|
20
|
-
|
22
|
+
derivatives.keys.first
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -29,21 +31,21 @@ module RailsAdmin
|
|
29
31
|
end
|
30
32
|
|
31
33
|
register_instance_option :cache_method do
|
32
|
-
name
|
34
|
+
name if bindings[:object].try("cached_#{name}_data")
|
33
35
|
end
|
34
36
|
|
35
37
|
register_instance_option :cache_value do
|
36
|
-
bindings[:object].
|
38
|
+
bindings[:object].try("cached_#{name}_data")
|
39
|
+
end
|
40
|
+
|
41
|
+
register_instance_option :link_name do
|
42
|
+
value.original_filename
|
37
43
|
end
|
38
44
|
|
39
45
|
def resource_url(thumb = nil)
|
40
46
|
return nil unless value
|
41
47
|
|
42
|
-
|
43
|
-
value[thumb || value.keys.first].url
|
44
|
-
else
|
45
|
-
value.url
|
46
|
-
end
|
48
|
+
thumb && bindings[:object].public_send(:"#{name}", thumb).try(:url) || value.url
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
data/lib/rails_admin/version.rb
CHANGED
data/lib/tasks/rails_admin.rake
CHANGED
@@ -12,18 +12,27 @@ namespace :rails_admin do
|
|
12
12
|
desc 'CI env for Travis'
|
13
13
|
task :prepare_ci_env do
|
14
14
|
adapter = ENV['CI_DB_ADAPTER'] || 'sqlite3'
|
15
|
-
database =
|
15
|
+
database = ('sqlite3' == adapter ? 'db/development.sqlite3' : 'ci_rails_admin')
|
16
|
+
username =
|
17
|
+
case adapter
|
18
|
+
when 'postgresql'
|
19
|
+
'postgres'
|
20
|
+
when 'mysql2'
|
21
|
+
'root'
|
22
|
+
else
|
23
|
+
''
|
24
|
+
end
|
16
25
|
|
17
26
|
configuration = {
|
18
27
|
'test' => {
|
19
28
|
'adapter' => adapter,
|
20
29
|
'database' => database,
|
21
|
-
'username' =>
|
22
|
-
'password' =>
|
23
|
-
'host' =>
|
24
|
-
'encoding' =>
|
25
|
-
'pool' =>
|
26
|
-
'timeout' =>
|
30
|
+
'username' => username,
|
31
|
+
'password' => ('postgresql' == adapter ? 'postgres' : ''),
|
32
|
+
'host' => '127.0.0.1',
|
33
|
+
'encoding' => 'utf8',
|
34
|
+
'pool' => 5,
|
35
|
+
'timeout' => 5000,
|
27
36
|
},
|
28
37
|
}
|
29
38
|
|
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: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Michaels-Ober
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
- Petteri Kaapa
|
10
10
|
- Benoit Benezech
|
11
11
|
- Mitsuhiro Shibuya
|
12
|
-
autorequire:
|
12
|
+
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2021-02-28 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: builder
|
@@ -599,7 +599,7 @@ homepage: https://github.com/sferik/rails_admin
|
|
599
599
|
licenses:
|
600
600
|
- MIT
|
601
601
|
metadata: {}
|
602
|
-
post_install_message:
|
602
|
+
post_install_message:
|
603
603
|
rdoc_options: []
|
604
604
|
require_paths:
|
605
605
|
- lib
|
@@ -614,8 +614,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
614
614
|
- !ruby/object:Gem::Version
|
615
615
|
version: 1.8.11
|
616
616
|
requirements: []
|
617
|
-
rubygems_version: 3.
|
618
|
-
signing_key:
|
617
|
+
rubygems_version: 3.2.3
|
618
|
+
signing_key:
|
619
619
|
specification_version: 4
|
620
620
|
summary: Admin for Rails
|
621
621
|
test_files: []
|