rails_admin 3.0.0.rc → 3.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails_admin might be problematic. Click here for more details.

Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -8
  3. data/app/assets/javascripts/{rails_admin.js → rails_admin/application.js} +0 -0
  4. data/app/assets/stylesheets/{rails_admin.scss → rails_admin/application.scss} +0 -0
  5. data/app/controllers/rails_admin/main_controller.rb +2 -3
  6. data/app/helpers/rails_admin/application_helper.rb +33 -11
  7. data/app/views/layouts/rails_admin/_head.html.erb +8 -5
  8. data/app/views/layouts/rails_admin/_secondary_navigation.html.erb +2 -2
  9. data/app/views/layouts/rails_admin/application.html.erb +1 -1
  10. data/app/views/rails_admin/main/export.html.erb +1 -1
  11. data/app/views/rails_admin/main/index.html.erb +2 -2
  12. data/app/views/rails_admin/main/show.html.erb +11 -9
  13. data/lib/generators/rails_admin/install_generator.rb +8 -6
  14. data/lib/rails_admin/abstract_model.rb +3 -4
  15. data/lib/rails_admin/adapters/active_record.rb +2 -1
  16. data/lib/rails_admin/adapters/mongoid.rb +2 -2
  17. data/lib/rails_admin/config/actions/base.rb +5 -0
  18. data/lib/rails_admin/config/actions/export.rb +2 -1
  19. data/lib/rails_admin/config/actions/index.rb +2 -1
  20. data/lib/rails_admin/config/actions/new.rb +2 -1
  21. data/lib/rails_admin/config/actions/show_in_app.rb +4 -0
  22. data/lib/rails_admin/config/fields/base.rb +2 -2
  23. data/lib/rails_admin/config/fields/factories/active_storage.rb +2 -1
  24. data/lib/rails_admin/config/fields/factories/association.rb +4 -4
  25. data/lib/rails_admin/config/fields/factories/carrierwave.rb +2 -1
  26. data/lib/rails_admin/config/fields/factories/devise.rb +2 -1
  27. data/lib/rails_admin/config/fields/factories/dragonfly.rb +2 -1
  28. data/lib/rails_admin/config/fields/factories/paperclip.rb +2 -1
  29. data/lib/rails_admin/config/fields/types/datetime.rb +2 -1
  30. data/lib/rails_admin/config.rb +14 -3
  31. data/lib/rails_admin/engine.rb +8 -9
  32. data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +2 -2
  33. data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +1 -1
  34. data/lib/rails_admin/version.rb +34 -1
  35. data/package.json +1 -1
  36. data/src/rails_admin/ui.js +19 -3
  37. data/vendor/assets/javascripts/rails_admin/flatpickr-with-locales.js +958 -395
  38. metadata +11 -6
@@ -3,7 +3,7 @@ module RailsAdmin
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
5
  PATCH = 0
6
- PRE = 'rc'.freeze
6
+ PRE = 'rc4'.freeze
7
7
 
8
8
  class << self
9
9
  # @return [String]
@@ -14,6 +14,39 @@ module RailsAdmin
14
14
  def js
15
15
  JSON.parse(File.read("#{__dir__}/../../package.json"))['version']
16
16
  end
17
+
18
+ def actual_js_version
19
+ case RailsAdmin.config.asset_source
20
+ when :webpacker, :webpack
21
+ js_version_from_node_modules
22
+ else
23
+ js
24
+ end
25
+ end
26
+
27
+ def warn_with_js_version
28
+ return unless Rails.env.development? || Rails.env.test?
29
+
30
+ case actual_js_version
31
+ when js
32
+ # Good
33
+ when nil
34
+ warn "[Warning] Failed to detect RailsAdmin npm package, did you run 'yarn install'?"
35
+ else
36
+ warn <<~MSG
37
+ [Warning] RailsAdmin npm package version inconsistency detected, expected #{js} but actually used is #{actual_js_version}.
38
+ This may cause partial or total malfunction of RailsAdmin frontend features.
39
+ MSG
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def js_version_from_node_modules
46
+ JSON.parse(File.read(Rails.root.join('node_modules/rails_admin/package.json')))['version']
47
+ rescue StandardError
48
+ nil
49
+ end
17
50
  end
18
51
  end
19
52
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_admin",
3
- "version": "3.0.0-rc",
3
+ "version": "3.0.0-rc4",
4
4
  "description": "RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data.",
5
5
  "homepage": "https://github.com/railsadminteam/rails_admin",
6
6
  "license": "MIT",
@@ -80,12 +80,28 @@ import I18n from "./i18n";
80
80
  .each(function () {
81
81
  $(this).siblings(".control-group").hide();
82
82
  });
83
- $("[formnovalidate]").on("click", function () {
84
- $(this).closest("form").attr("novalidate", true);
85
- });
83
+ $('button[name][type="submit"]')
84
+ .attr("type", "button")
85
+ .on("click", function () {
86
+ var form = $(this).closest("form");
87
+ form.append(
88
+ $("<input />")
89
+ .attr("type", "hidden")
90
+ .attr("name", $(this).attr("name"))
91
+ .attr("value", true)
92
+ );
93
+ if ($(this).is("[formnovalidate]")) {
94
+ form.attr("novalidate", true);
95
+ }
96
+ form.trigger("submit");
97
+ });
86
98
  $.each($("#filters_box").data("options"), function () {
87
99
  $.filters.append(this);
88
100
  });
101
+ // Workaround for https://github.com/heartcombo/devise/issues/5458
102
+ $("a[data-method]").on("click", function (event) {
103
+ window.Turbo.session.drive = false;
104
+ });
89
105
  });
90
106
 
91
107
  $(document).on("click", ".bulk-link", function (event) {