rails_admin 0.8.1 → 1.0.0.rc
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 +3 -15
- data/LICENSE.md +1 -1
- data/README.md +21 -8
- data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/rails_admin/bootstrap/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/rails_admin/bootstrap/glyphicons-halflings.png +0 -0
- data/app/assets/images/rails_admin/bullet_black.png +0 -0
- data/app/assets/images/rails_admin/bullet_white.png +0 -0
- data/app/assets/images/rails_admin/calendar.png +0 -0
- data/app/assets/images/rails_admin/clock.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/select.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/slider.png +0 -0
- data/app/assets/images/rails_admin/magnifier.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +1 -1
- data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.coffee +4 -1
- data/app/assets/javascripts/rails_admin/ra.remote-form.js +4 -1
- data/app/assets/javascripts/rails_admin/rails_admin.js +1 -1
- data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +5 -5
- data/app/assets/stylesheets/rails_admin/ra.widgets.scss +5 -1
- data/app/controllers/rails_admin/application_controller.rb +3 -3
- data/app/controllers/rails_admin/main_controller.rb +6 -6
- data/app/helpers/rails_admin/application_helper.rb +5 -5
- data/app/helpers/rails_admin/form_builder.rb +1 -1
- data/app/helpers/rails_admin/main_helper.rb +1 -1
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_gap.html.haml +0 -0
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_next_page.html.haml +0 -0
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_page.html.haml +0 -0
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_paginator.html.haml +0 -0
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_prev_page.html.haml +0 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +1 -1
- data/app/views/rails_admin/main/_form_colorpicker.html.haml +1 -1
- data/app/views/rails_admin/main/dashboard.html.haml +5 -5
- data/app/views/rails_admin/main/export.html.haml +45 -36
- data/app/views/rails_admin/main/history.html.haml +2 -2
- data/app/views/rails_admin/main/index.html.haml +1 -1
- data/config/locales/rails_admin.en.yml +1 -1
- data/lib/generators/rails_admin/templates/initializer.erb +4 -0
- data/lib/rails_admin.rb +23 -0
- data/lib/rails_admin/adapters/active_record.rb +8 -3
- data/lib/rails_admin/adapters/mongoid.rb +10 -13
- data/lib/rails_admin/adapters/mongoid/abstract_object.rb +1 -0
- data/lib/rails_admin/adapters/mongoid/association.rb +1 -0
- data/lib/rails_admin/adapters/mongoid/bson.rb +29 -0
- data/lib/rails_admin/config.rb +12 -6
- data/lib/rails_admin/config/actions/bulk_delete.rb +2 -2
- data/lib/rails_admin/config/actions/dashboard.rb +3 -3
- data/lib/rails_admin/config/actions/export.rb +1 -1
- data/lib/rails_admin/config/actions/index.rb +6 -2
- data/lib/rails_admin/config/actions/new.rb +2 -1
- data/lib/rails_admin/config/fields/association.rb +5 -1
- data/lib/rails_admin/config/fields/types/active_record_enum.rb +4 -0
- data/lib/rails_admin/config/fields/types/bson_object_id.rb +1 -15
- data/lib/rails_admin/config/fields/types/datetime.rb +5 -2
- data/lib/rails_admin/config/fields/types/file_upload.rb +1 -1
- data/lib/rails_admin/config/fields/types/serialized.rb +2 -2
- data/lib/rails_admin/config/fields/types/wysihtml5.rb +2 -2
- data/lib/rails_admin/config/lazy_model.rb +44 -4
- data/lib/rails_admin/config/model.rb +1 -1
- data/lib/rails_admin/engine.rb +0 -1
- data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +2 -1
- data/lib/rails_admin/support/csv_converter.rb +9 -13
- data/lib/rails_admin/support/datetime.rb +6 -5
- data/lib/rails_admin/support/i18n.rb +7 -5
- data/lib/rails_admin/version.rb +4 -4
- metadata +22 -30
- data/app/assets/javascripts/rails_admin/jquery.remotipart.fixed.js +0 -72
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad179cb9f029df989c979439f2e5debb9b2a8f23
|
|
4
|
+
data.tar.gz: 2a148ec6c217c0dc67369cb0164bed57db97b953
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5c61a2c10d83cdbc00fb163974026eba3a940bd998e674a2e0a256b41f7a9aec821e6aca93a3904bc801d6ee240022bc736b04764bea11953f64ef705ed1d7e
|
|
7
|
+
data.tar.gz: aa9a9cfb2e7eda6f0fd9b3bc2fe16430eb83120499da7e87f0361a93a3b3734e458ec6ac0a0bd553bb6d25fa7f4829f3e717ad15d6cf195efd4771e3b62b0738
|
data/Gemfile
CHANGED
|
@@ -2,13 +2,7 @@ source 'https://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
gem 'appraisal', '>= 2.0'
|
|
4
4
|
gem 'devise'
|
|
5
|
-
|
|
6
|
-
group :mongoid do
|
|
7
|
-
gem 'mongoid', '~> 4.0.0'
|
|
8
|
-
gem 'mongoid-paperclip', '>= 0.0.8', require: 'mongoid_paperclip'
|
|
9
|
-
gem 'carrierwave-mongoid', '>= 0.6.3', require: 'carrierwave/mongoid'
|
|
10
|
-
gem 'refile-mongoid', '>= 0.0.1', platforms: [:ruby_21, :ruby_22]
|
|
11
|
-
end
|
|
5
|
+
gem 'remotipart', github: 'mshibuya/remotipart'
|
|
12
6
|
|
|
13
7
|
group :active_record do
|
|
14
8
|
platforms :jruby do
|
|
@@ -26,7 +20,7 @@ group :active_record do
|
|
|
26
20
|
gem 'sqlite3', '>= 1.3'
|
|
27
21
|
end
|
|
28
22
|
|
|
29
|
-
gem 'paper_trail', '
|
|
23
|
+
gem 'paper_trail', '>= 5.0'
|
|
30
24
|
end
|
|
31
25
|
|
|
32
26
|
group :development, :test do
|
|
@@ -36,7 +30,6 @@ end
|
|
|
36
30
|
group :test do
|
|
37
31
|
gem 'cancan', '>= 1.6'
|
|
38
32
|
gem 'cancancan', '~> 1.12.0'
|
|
39
|
-
gem 'capybara', '>= 2.1'
|
|
40
33
|
gem 'carrierwave', '>= 0.8'
|
|
41
34
|
gem 'coveralls'
|
|
42
35
|
gem 'database_cleaner', ['>= 1.2', '!= 1.4.0', '!= 1.5.0']
|
|
@@ -55,12 +48,7 @@ group :test do
|
|
|
55
48
|
gem 'timecop', '>= 0.5'
|
|
56
49
|
|
|
57
50
|
platforms :ruby_19 do
|
|
58
|
-
gem 'tins', '~> 1.6.0'
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
platforms :ruby_21, :ruby_22 do
|
|
62
|
-
gem 'refile', '~> 0.5', require: 'refile/rails'
|
|
63
|
-
gem 'refile-mini_magick', '>= 0.1.0'
|
|
51
|
+
gem 'tins', '~> 1.6.0', require: false
|
|
64
52
|
end
|
|
65
53
|
end
|
|
66
54
|
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[][inch]
|
|
9
9
|
|
|
10
10
|
[gem]: https://rubygems.org/gems/rails_admin
|
|
11
|
-
[travis]:
|
|
11
|
+
[travis]: https://travis-ci.org/sferik/rails_admin
|
|
12
12
|
[gemnasium]: https://gemnasium.com/sferik/rails_admin
|
|
13
13
|
[codeclimate]: https://codeclimate.com/github/sferik/rails_admin
|
|
14
14
|
[coveralls]: https://coveralls.io/r/sferik/rails_admin
|
|
@@ -33,10 +33,24 @@ RailsAdmin is a Rails engine that provides an easy-to-use interface for managing
|
|
|
33
33
|
|
|
34
34
|
## Installation
|
|
35
35
|
|
|
36
|
-
1.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
1. On your gemfile:
|
|
37
|
+
- For Rails 5 project:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
gem 'remotipart', github: 'mshibuya/remotipart'
|
|
41
|
+
gem 'rails_admin', '>= 1.0.0.rc'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- For Rails 4 project:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
gem 'rails_admin'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. Run `bundle install`
|
|
51
|
+
3. Run `rails g rails_admin:install`
|
|
52
|
+
4. Provide a namespace for the routes when asked
|
|
53
|
+
5. Start a server `rails s` and administer your data at [/admin](http://localhost:3000/admin). (if you chose default namespace: /admin)
|
|
40
54
|
|
|
41
55
|
## Configuration
|
|
42
56
|
### Global
|
|
@@ -87,12 +101,11 @@ If you think you found a bug in RailsAdmin, you can [submit an issue](https://gi
|
|
|
87
101
|
## Supported Ruby Versions
|
|
88
102
|
This library aims to support and is [tested against][travis] the following Ruby implementations:
|
|
89
103
|
|
|
90
|
-
* Ruby 1.9.3
|
|
91
|
-
* Ruby 2.0.0
|
|
92
104
|
* Ruby 2.1
|
|
93
105
|
* Ruby 2.2
|
|
106
|
+
* Ruby 2.3
|
|
94
107
|
* [Rubinius][]
|
|
95
108
|
* [JRuby][]
|
|
96
109
|
|
|
97
|
-
[rubinius]: http://
|
|
110
|
+
[rubinius]: http://rubinius.com
|
|
98
111
|
[jruby]: http://jruby.org/
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
|
|
102
102
|
var $content = $('<p>')
|
|
103
103
|
.addClass('filter form-search')
|
|
104
|
-
.append('<span class="label label-info form-label"><a href="#delete" class="delete"><i class="fa fa-trash-o fa-fw icon-white"></i
|
|
104
|
+
.append('<span class="label label-info form-label"><a href="#delete" class="delete"><i class="fa fa-trash-o fa-fw icon-white"></i>' + field_label + '</a></span>')
|
|
105
105
|
.append(' ' + control + ' ' + (additional_control || ''));
|
|
106
106
|
|
|
107
107
|
$('#filters_box').append($content);
|
|
@@ -29,7 +29,7 @@ $(document).on 'nested:fieldAdded', 'form', (content) ->
|
|
|
29
29
|
$(document).on 'nested:fieldRemoved', 'form', (content) ->
|
|
30
30
|
field = content.field
|
|
31
31
|
nav = field.closest(".control-group").children('.controls').children('.nav')
|
|
32
|
-
current_li = nav.children('li').has('a[href
|
|
32
|
+
current_li = nav.children('li').has('a[href="#' + field.attr('id') + '"]')
|
|
33
33
|
parent_group = field.closest(".control-group")
|
|
34
34
|
controls = parent_group.children('.controls')
|
|
35
35
|
one_to_one = controls.data('nestedone') != undefined
|
|
@@ -50,3 +50,6 @@ $(document).on 'nested:fieldRemoved', 'form', (content) ->
|
|
|
50
50
|
add_button = toggler.next()
|
|
51
51
|
add_button.addClass('add_nested_fields').html(add_button.data('add-label'))
|
|
52
52
|
|
|
53
|
+
# Removing all required attributes from deleted child form to bypass browser validations.
|
|
54
|
+
field.find('[required]').each ->
|
|
55
|
+
$(this).removeAttr('required')
|
|
@@ -91,7 +91,10 @@
|
|
|
91
91
|
dialog.find('.modal-body').html(data.responseText);
|
|
92
92
|
widget._bindFormEvents();
|
|
93
93
|
} else {
|
|
94
|
-
|
|
94
|
+
// responseText may contain redundant try-catch clause added by remotipart
|
|
95
|
+
// https://github.com/JangoSteve/remotipart/blob/c08d61137ee18e0e78eb3cd9ca3030479fd101f1/lib/remotipart/render_overrides.rb#L17
|
|
96
|
+
var responseText = data.responseText.replace(/^try{[^}]+}catch\(err\){[^}]+}/, '');
|
|
97
|
+
var json = $.parseJSON(responseText);
|
|
95
98
|
var option = '<option value="' + json.id + '" selected>' + json.label + '</option>';
|
|
96
99
|
var select = widget.element.find('select').filter(":hidden");
|
|
97
100
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
background: -webkit-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* Chrome10+,Safari5.1+ */
|
|
70
70
|
background: -o-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* Opera11.10+ */
|
|
71
71
|
background: -ms-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* IE10+ */
|
|
72
|
-
background: linear-gradient(
|
|
72
|
+
background: linear-gradient(to bottom, #ededed 0%,#c4c4c4 100%); /* W3C */
|
|
73
73
|
}
|
|
74
74
|
.ui-widget-header a { color: #4F4F4F; }
|
|
75
75
|
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
background: -webkit-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* Chrome10+,Safari5.1+ */
|
|
84
84
|
background: -o-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* Opera11.10+ */
|
|
85
85
|
background: -ms-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* IE10+ */
|
|
86
|
-
background: linear-gradient(
|
|
86
|
+
background: linear-gradient(to bottom, #ededed 0%,#c4c4c4 100%); /* W3C */
|
|
87
87
|
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
|
|
88
88
|
-moz-box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
|
|
89
89
|
box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
background: -webkit-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* Chrome10+,Safari5.1+ */
|
|
101
101
|
background: -o-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* Opera11.10+ */
|
|
102
102
|
background: -ms-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* IE10+ */
|
|
103
|
-
background: linear-gradient(
|
|
103
|
+
background: linear-gradient(to bottom, #b9e0f5 0%,#92bdd6 100%); /* W3C */
|
|
104
104
|
-webkit-box-shadow: none;
|
|
105
105
|
-moz-box-shadow: none;
|
|
106
106
|
box-shadow: none;
|
|
@@ -481,7 +481,7 @@ button.ui-button-icons-only { width: 3.7em; }
|
|
|
481
481
|
background: -webkit-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* Chrome10+,Safari5.1+ */
|
|
482
482
|
background: -o-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* Opera11.10+ */
|
|
483
483
|
background: -ms-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* IE10+ */
|
|
484
|
-
background: linear-gradient(
|
|
484
|
+
background: linear-gradient(to bottom, #b9e0f5 0%,#92bdd6 100%); /* W3C */
|
|
485
485
|
-moz-box-shadow: 0 0 8px rgba(0, 0, 0, 0.15), 0 1px 0 rgba(255,255,255,0.8) inset;
|
|
486
486
|
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.15), 0 1px 0 rgba(255,255,255,0.8) inset;
|
|
487
487
|
box-shadow: 0 0 8px rgba(0, 0, 0, 0.15), 0 1px 0 rgba(255,255,255,0.8) inset;
|
|
@@ -527,7 +527,7 @@ input.ui-button::-moz-focus-inner {
|
|
|
527
527
|
background: -webkit-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* Chrome10+,Safari5.1+ */
|
|
528
528
|
background: -o-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* Opera11.10+ */
|
|
529
529
|
background: -ms-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* IE10+ */
|
|
530
|
-
background: linear-gradient(
|
|
530
|
+
background: linear-gradient(to bottom, #b9e0f5 0%,#92bdd6 100%); /* W3C */
|
|
531
531
|
-webkit-box-shadow: none;
|
|
532
532
|
-moz-box-shadow: none;
|
|
533
533
|
box-shadow: none;
|
|
@@ -11,9 +11,9 @@ module RailsAdmin
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
class ApplicationController < Config.parent_controller.constantize
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
before_action :_authenticate!
|
|
15
|
+
before_action :_authorize!
|
|
16
|
+
before_action :_audit!
|
|
17
17
|
|
|
18
18
|
helper_method :_current_user, :_get_plugin_name
|
|
19
19
|
|
|
@@ -6,9 +6,9 @@ module RailsAdmin
|
|
|
6
6
|
|
|
7
7
|
layout :get_layout
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
before_action :get_model, except: RailsAdmin::Config::Actions.all(:root).collect(&:action_name)
|
|
10
|
+
before_action :get_object, only: RailsAdmin::Config::Actions.all(:member).collect(&:action_name)
|
|
11
|
+
before_action :check_for_cancel
|
|
12
12
|
|
|
13
13
|
RailsAdmin::Config::Actions.all.each do |action|
|
|
14
14
|
class_eval <<-EOS, __FILE__, __LINE__ + 1
|
|
@@ -75,7 +75,7 @@ module RailsAdmin
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def redirect_to_on_success
|
|
78
|
-
notice = t('admin.flash.successful', name: @model_config.label, action: t("admin.actions.#{@action.key}.done"))
|
|
78
|
+
notice = I18n.t('admin.flash.successful', name: @model_config.label, action: I18n.t("admin.actions.#{@action.key}.done"))
|
|
79
79
|
if params[:_add_another]
|
|
80
80
|
redirect_to new_path(return_to: params[:return_to]), flash: {success: notice}
|
|
81
81
|
elsif params[:_add_edit]
|
|
@@ -105,7 +105,7 @@ module RailsAdmin
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def handle_save_error(whereto = :new)
|
|
108
|
-
flash.now[:error] = t('admin.flash.error', name: @model_config.label, action: t("admin.actions.#{@action.key}.done").html_safe).html_safe
|
|
108
|
+
flash.now[:error] = I18n.t('admin.flash.error', name: @model_config.label, action: I18n.t("admin.actions.#{@action.key}.done").html_safe).html_safe
|
|
109
109
|
flash.now[:error] += %(<br>- #{@object.errors.full_messages.join('<br>- ')}).html_safe
|
|
110
110
|
|
|
111
111
|
respond_to do |format|
|
|
@@ -116,7 +116,7 @@ module RailsAdmin
|
|
|
116
116
|
|
|
117
117
|
def check_for_cancel
|
|
118
118
|
return unless params[:_continue] || (params[:bulk_action] && !params[:bulk_ids])
|
|
119
|
-
redirect_to(back_or_index, notice: t('admin.flash.noaction'))
|
|
119
|
+
redirect_to(back_or_index, notice: I18n.t('admin.flash.noaction'))
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
def get_collection(model_config, scope, pagination)
|
|
@@ -35,9 +35,9 @@ module RailsAdmin
|
|
|
35
35
|
return nil unless _current_user.respond_to?(:email)
|
|
36
36
|
return nil unless abstract_model = RailsAdmin.config(_current_user.class).abstract_model
|
|
37
37
|
return nil unless (edit_action = RailsAdmin::Config::Actions.find(:edit, controller: controller, abstract_model: abstract_model, object: _current_user)).try(:authorized?)
|
|
38
|
-
link_to url_for(action: edit_action.action_name, model_name: abstract_model.to_param, id: _current_user.id, controller: 'rails_admin/main') do
|
|
38
|
+
link_to rails_admin.url_for(action: edit_action.action_name, model_name: abstract_model.to_param, id: _current_user.id, controller: 'rails_admin/main') do
|
|
39
39
|
html = []
|
|
40
|
-
html << image_tag("#{(request.ssl? ? 'https://secure' : 'http://www')}.gravatar.com/avatar/#{Digest::MD5.hexdigest _current_user.email}?s=30", alt: '') if _current_user.email.present?
|
|
40
|
+
html << image_tag("#{(request.ssl? ? 'https://secure' : 'http://www')}.gravatar.com/avatar/#{Digest::MD5.hexdigest _current_user.email}?s=30", alt: '') if RailsAdmin::Config.show_gravatar && _current_user.email.present?
|
|
41
41
|
html << content_tag(:span, _current_user.email)
|
|
42
42
|
html.join.html_safe
|
|
43
43
|
end
|
|
@@ -97,7 +97,7 @@ module RailsAdmin
|
|
|
97
97
|
def navigation(nodes_stack, nodes, level = 0)
|
|
98
98
|
nodes.collect do |node|
|
|
99
99
|
model_param = node.abstract_model.to_param
|
|
100
|
-
url = url_for(action: :index, controller: 'rails_admin/main', model_name: model_param)
|
|
100
|
+
url = rails_admin.url_for(action: :index, controller: 'rails_admin/main', model_name: model_param)
|
|
101
101
|
level_class = " nav-level-#{level}" if level > 0
|
|
102
102
|
nav_icon = node.navigation_icon ? %(<i class="#{node.navigation_icon}"></i>).html_safe : ''
|
|
103
103
|
li = content_tag :li, data: {model: model_param} do
|
|
@@ -120,7 +120,7 @@ module RailsAdmin
|
|
|
120
120
|
crumb = begin
|
|
121
121
|
if !current_action?(a, am, o)
|
|
122
122
|
if a.http_methods.include?(:get)
|
|
123
|
-
link_to url_for(action: a.action_name, controller: 'rails_admin/main', model_name: am.try(:to_param), id: (o.try(:persisted?) && o.try(:id) || nil)), class: 'pjax' do
|
|
123
|
+
link_to rails_admin.url_for(action: a.action_name, controller: 'rails_admin/main', model_name: am.try(:to_param), id: (o.try(:persisted?) && o.try(:id) || nil)), class: 'pjax' do
|
|
124
124
|
wording_for(:breadcrumb, a, am, o)
|
|
125
125
|
end
|
|
126
126
|
else
|
|
@@ -143,7 +143,7 @@ module RailsAdmin
|
|
|
143
143
|
wording = wording_for(:menu, action)
|
|
144
144
|
%(
|
|
145
145
|
<li title="#{wording if only_icon}" rel="#{'tooltip' if only_icon}" class="icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}">
|
|
146
|
-
<a class="#{action.pjax? ? 'pjax' : ''}" href="#{url_for(action: action.action_name, controller: 'rails_admin/main', model_name: abstract_model.try(:to_param), id: (object.try(:persisted?) && object.try(:id) || nil))}">
|
|
146
|
+
<a class="#{action.pjax? ? 'pjax' : ''}" href="#{rails_admin.url_for(action: action.action_name, controller: 'rails_admin/main', model_name: abstract_model.try(:to_param), id: (object.try(:persisted?) && object.try(:id) || nil))}">
|
|
147
147
|
<i class="#{action.link_icon}"></i>
|
|
148
148
|
<span#{only_icon ? " style='display:none'" : ''}>#{wording}</span>
|
|
149
149
|
</a>
|
|
@@ -131,7 +131,7 @@ module RailsAdmin
|
|
|
131
131
|
|
|
132
132
|
def nested_field_association?(field, nested_in)
|
|
133
133
|
field.inverse_of.presence && nested_in.presence && field.inverse_of == nested_in.name &&
|
|
134
|
-
(@template.instance_variable_get(:@model_config).abstract_model == field.
|
|
134
|
+
(@template.instance_variable_get(:@model_config).abstract_model == field.abstract_model ||
|
|
135
135
|
field.name == nested_in.inverse_of)
|
|
136
136
|
end
|
|
137
137
|
end
|
|
@@ -43,7 +43,7 @@ module RailsAdmin
|
|
|
43
43
|
def ordered_filters
|
|
44
44
|
return @ordered_filters if @ordered_filters.present?
|
|
45
45
|
@index = 0
|
|
46
|
-
@ordered_filters = (params[:f] || @model_config.list.filters).inject({}) do |memo, filter|
|
|
46
|
+
@ordered_filters = (params[:f].try(:permit!).try(:to_h) || @model_config.list.filters).inject({}) do |memo, filter|
|
|
47
47
|
field_name = filter.is_a?(Array) ? filter.first : filter
|
|
48
48
|
(filter.is_a?(Array) ? filter.last : {(@index += 1) => {'v' => ''}}).each do |index, filter_hash|
|
|
49
49
|
if filter_hash['disabled'].blank?
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
%ul.nav.navbar-nav.navbar-right.root_links
|
|
2
2
|
- actions(:root).each do |action|
|
|
3
|
-
%li{class: "#{action.action_name}_root_link"}= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: "pjax"
|
|
3
|
+
%li{class: "#{action.action_name}_root_link"}= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: action.pjax? ? "pjax" : ""
|
|
4
4
|
- if main_app_root_path = (main_app.root_path rescue false)
|
|
5
5
|
%li= link_to t('admin.home.name'), main_app_root_path
|
|
6
6
|
- if _current_user
|