rails_admin 3.1.0 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4703829ff74c1be721a1622986bfe87c98c07e908991e997c903070c12216255
4
- data.tar.gz: 3eddba360a94a4bd0a3d3e0c1eb62af9752b90e4637082b3ce6e3d576274c7b8
3
+ metadata.gz: 30d6fc9f03e406c3d6fa8dd301e3eef853896b37cac25945932c0d419a7976be
4
+ data.tar.gz: 508731ccf0a76e22863b6734ea577810cace41acc9c88ab8211b09a7bdf4a74e
5
5
  SHA512:
6
- metadata.gz: b13e1468096711b8dfc4217563f26524512e2e219cdf69bf56aece88400bce7a3b2ec958fc1676f1fd253745c86ca1739f35f0e199983e0597fce986cda41484
7
- data.tar.gz: bdb5a417cd53c3e301358ce96452b3d96acc73ccdd752a81187429aaabaa969c7c77fa02ee72be201c8303e61a3f6ffc3f07aea77ac1fb3a8d70da717c117647
6
+ metadata.gz: 16acc5f74fa950492490ed2a20e589368bf67f5d614b8c729aec7308240d0c8e1b7e92531408681a169b1670cd11dbb0cc500ac69517755f5fb7b5e84447a4ad
7
+ data.tar.gz: 06bf86fd3219b28249f42503f0de0a053b4c528a995c06096d2c44f9250cc8383ba32709d31d43b022608d177531754fcf4bde2dff82ad55beb9a5ba4517928e
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # RailsAdmin
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/rails_admin.svg)][gem]
4
- [![Build Status](https://img.shields.io/github/workflow/status/railsadminteam/rails_admin/Test)][ghactions]
4
+ [![Build Status](https://github.com/railsadminteam/rails_admin/actions/workflows/test.yml/badge.svg)][ghactions]
5
5
  [![Coverage Status](https://img.shields.io/coveralls/railsadminteam/rails_admin.svg)][coveralls]
6
6
  [![Code Climate](https://codeclimate.com/github/railsadminteam/rails_admin.svg)][codeclimate]
7
7
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rails_admin&package-manager=bundler&version-scheme=semver)][semver]
8
8
 
9
9
  [gem]: https://rubygems.org/gems/rails_admin
10
- [ghactions]: https://github.com/railsadminteam/rails_admin/actions
10
+ [ghactions]: https://github.com/railsadminteam/rails_admin/actions/workflows/test.yml
11
11
  [coveralls]: https://coveralls.io/r/railsadminteam/rails_admin
12
12
  [codeclimate]: https://codeclimate.com/github/railsadminteam/rails_admin
13
13
  [semver]: https://dependabot.com/compatibility-score.html?dependency-name=rails_admin&package-manager=bundler&version-scheme=semver
@@ -98,6 +98,8 @@ This library aims to support and is [tested against][ghactions] the following Ru
98
98
  - Ruby 2.6
99
99
  - Ruby 2.7
100
100
  - Ruby 3.0
101
+ - Ruby 3.1
102
+ - Ruby 3.2
101
103
  - [JRuby][]
102
104
 
103
105
  [jruby]: http://jruby.org/
@@ -122,7 +122,7 @@ module RailsAdmin
122
122
  nav_icon = node.navigation_icon ? %(<i class="#{node.navigation_icon}"></i>).html_safe : ''
123
123
  css_classes = ['nav-link']
124
124
  css_classes.push("nav-level-#{level}") if level > 0
125
- css_classes.push('active') if defined?(@action) && current_action?(@action, model_param)
125
+ css_classes.push('active') if @action && current_action?(@action, model_param)
126
126
  li = content_tag :li, data: {model: model_param} do
127
127
  link_to nav_icon + " " + node.label_plural, url, class: css_classes.join(' ')
128
128
  end
@@ -1,4 +1,4 @@
1
- <ul class="sidebar col-sm-3 col-md-2 nav btn-toggle-nav flex-column bg-light">
1
+ <ul class="sidebar col-sm-3 col-md-2 nav btn-toggle-nav flex-column flex-nowrap bg-light">
2
2
  <%= main_navigation %>
3
3
  <%= root_navigation %>
4
4
  <%= static_navigation %>
@@ -11,7 +11,7 @@ module RailsAdmin
11
11
  end
12
12
 
13
13
  def format
14
- imports = packager.import("rails_admin@#{RailsAdmin::Version.js}")
14
+ imports = packager.import("rails_admin@#{RailsAdmin::Version.js}", from: 'jspm.io')
15
15
 
16
16
  # Use ESM compatible version to work around https://github.com/cljsjs/packages/issues/1579
17
17
  imports['@popperjs/core'].gsub!('lib/index.js', 'dist/esm/popper.js')
@@ -64,6 +64,8 @@ module RailsAdmin
64
64
  run "yarn add rails_admin@#{RailsAdmin::Version.js}"
65
65
  template 'rails_admin.webpacker.js', 'app/javascript/packs/rails_admin.js'
66
66
  template 'rails_admin.scss.erb', 'app/javascript/stylesheets/rails_admin.scss'
67
+ # To work around https://github.com/railsadminteam/rails_admin/issues/3565
68
+ add_package_json_field('resolutions', {'rails_admin/@fortawesome/fontawesome-free' => '^5.15.0'})
67
69
  end
68
70
 
69
71
  def configure_for_webpack
@@ -99,28 +101,29 @@ module RailsAdmin
99
101
  else
100
102
  add_file 'config/initializers/assets.rb', asset_config
101
103
  end
102
- add_scripts(additional_script_entries.merge({'build:css' => 'sass ./app/assets/stylesheets/rails_admin.scss:./app/assets/builds/rails_admin.css --no-source-map --load-path=node_modules'}))
104
+ add_package_json_field('scripts', additional_script_entries.merge({'build:css' => 'sass ./app/assets/stylesheets/rails_admin.scss:./app/assets/builds/rails_admin.css --no-source-map --load-path=node_modules'}), <<~INSTRUCTION)
105
+ Taking 'build:css' as an example, if you're already have application.sass.css for the sass build, the resulting script would look like:
106
+ sass ./app/assets/stylesheets/application.sass.scss:./app/assets/builds/application.css ./app/assets/stylesheets/rails_admin.scss:./app/assets/builds/rails_admin.css --no-source-map --load-path=node_modules
107
+ INSTRUCTION
103
108
  end
104
109
 
105
- def add_scripts(entries)
106
- display 'Add scripts to package.json'
110
+ def add_package_json_field(name, entries, instruction = nil)
111
+ display "Add #{name} to package.json"
107
112
  package = begin
108
113
  JSON.parse(File.read(File.join(destination_root, 'package.json')))
109
114
  rescue Errno::ENOENT, JSON::ParserError
110
115
  {}
111
116
  end
112
- if package['scripts'] && (package['scripts'].keys & entries.keys).any?
113
- say <<-MESSAGE.gsub(/^ {10}/, ''), :red
114
- You need to merge "scripts": #{JSON.pretty_generate(entries)} into the existing scripts in your package.json .
115
- Taking 'build:css' as an example, if you're already have application.sass.css for the sass build, the resulting script would look like:
116
- sass ./app/assets/stylesheets/application.sass.scss:./app/assets/builds/application.css ./app/assets/stylesheets/rails_admin.scss:./app/assets/builds/rails_admin.css --no-source-map --load-path=node_modules
117
+ if package[name] && (package[name].keys & entries.keys).any?
118
+ say <<~MESSAGE, :red
119
+ You need to merge "#{name}": #{JSON.pretty_generate(entries)} into the existing #{name} in your package.json.#{instruction && "\n#{instruction}"}
117
120
  MESSAGE
118
121
  else
119
- package['scripts'] ||= {}
120
- entries.each do |entry, build_script|
121
- package['scripts'][entry] = build_script
122
+ package[name] ||= {}
123
+ entries.each do |entry, value|
124
+ package[name][entry] = value
122
125
  end
123
- add_file 'package.json', JSON.pretty_generate(package)
126
+ add_file 'package.json', "#{JSON.pretty_generate(package)}\n"
124
127
  end
125
128
  end
126
129
  end
@@ -1 +1 @@
1
- <%= instance_variable_defined?(:@fa_font_path) ? %{$fa-font-path: "#{@fa_font_path}";\n} : '' %>@import "rails_admin/src/rails_admin/styles/base";
1
+ <%= @fa_font_path ? %{$fa-font-path: "#{@fa_font_path}";\n} : '' %>@import "rails_admin/src/rails_admin/styles/base";
@@ -1,2 +1,2 @@
1
1
  import "rails_admin/src/rails_admin/base";
2
- import "../stylesheets/rails_admin.scss";
2
+ import "../stylesheets/rails_admin.scss";
@@ -48,7 +48,7 @@ module RailsAdmin
48
48
  # :
49
49
  # end
50
50
  #
51
- # Thus, sort all blocks to excute for a resource by Proc.source_path,
51
+ # Thus, sort all blocks to execute for a resource by Proc.source_path,
52
52
  # to guarantee that blocks from 'config/initializers' evaluate before
53
53
  # blocks defined within a model class.
54
54
  unless @deferred_blocks.empty?
@@ -364,23 +364,22 @@ module RailsAdmin
364
364
 
365
365
  private
366
366
 
367
- def lchomp(base, arg)
368
- base.to_s.reverse.chomp(arg.to_s.reverse).reverse
369
- end
370
-
371
367
  def viable_models
372
368
  included_models.collect(&:to_s).presence || begin
373
369
  @@system_models ||= # memoization for tests
374
370
  ([Rails.application] + Rails::Engine.subclasses.collect(&:instance)).flat_map do |app|
375
371
  (app.paths['app/models'].to_a + app.config.eager_load_paths).collect do |load_path|
376
372
  Dir.glob(app.root.join(load_path)).collect do |load_dir|
373
+ path_prefix = "#{app.root.join(load_dir)}/"
377
374
  Dir.glob("#{load_dir}/**/*.rb").collect do |filename|
378
375
  # app/models/module/class.rb => module/class.rb => module/class => Module::Class
379
- lchomp(filename, "#{app.root.join(load_dir)}/").chomp('.rb').camelize
376
+ filename.delete_prefix(path_prefix).chomp('.rb').camelize
380
377
  end
381
378
  end
382
379
  end
383
380
  end.flatten.reject { |m| m.starts_with?('Concerns::') } # rubocop:disable Style/MultilineBlockChain
381
+
382
+ @@system_models + @registry.keys.collect(&:to_s)
384
383
  end
385
384
  end
386
385
 
@@ -1,4 +1,3 @@
1
- # encoding: UTF-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'csv'
@@ -4,7 +4,7 @@ module RailsAdmin
4
4
  class Version
5
5
  MAJOR = 3
6
6
  MINOR = 1
7
- PATCH = 0
7
+ PATCH = 2
8
8
  PRE = nil
9
9
 
10
10
  class << self
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_admin",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
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",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.16.7",
18
- "@fortawesome/fontawesome-free": "^6.1.1",
18
+ "@fortawesome/fontawesome-free": ">=5.15.0 <7.0.0",
19
19
  "@hotwired/turbo-rails": "^7.1.0",
20
20
  "@popperjs/core": "^2.11.0",
21
21
  "@rails/ujs": "^6.1.4-1",
@@ -1,6 +1,6 @@
1
1
  import Rails from "@rails/ujs";
2
2
  import "@hotwired/turbo-rails";
3
- import jQuery from "jquery";
3
+ import "./jquery";
4
4
  import "./vendor/jquery_nested_form";
5
5
  import "bootstrap";
6
6
 
@@ -27,4 +27,3 @@ import "./ui";
27
27
  import "./widgets";
28
28
 
29
29
  Rails.start();
30
- window.$ = window.jQuery = jQuery;
@@ -172,7 +172,7 @@ import flatpickr from "flatpickr";
172
172
  }
173
173
 
174
174
  var filterContainerId = field_name + "-" + index + "-filter-container";
175
- $("p#" + filterContainerId).remove();
175
+ $("#" + filterContainerId).remove();
176
176
 
177
177
  var $content = $("<div>")
178
178
  .attr("id", filterContainerId)
@@ -0,0 +1,3 @@
1
+ import jQuery from "jquery";
2
+
3
+ window.$ = window.jQuery = jQuery;
@@ -88,7 +88,7 @@ import I18n from "./i18n";
88
88
  $(document).ready(triggerDomReady);
89
89
  document.addEventListener("turbo:render", triggerDomReady);
90
90
 
91
- document.addEventListener("rails_admin.dom_ready", function () {
91
+ document.addEventListener("rails_admin.dom_ready", function (event) {
92
92
  $(".nav.nav-pills li.active").removeClass("active");
93
93
  $(
94
94
  '.nav.nav-pills li[data-model="' + $(".page-header").data("model") + '"]'
@@ -129,6 +129,12 @@ import I18n from "./i18n";
129
129
  $("a[data-method]").on("click", function (event) {
130
130
  window.Turbo.session.drive = false;
131
131
  });
132
+
133
+ // Trigger via jQuery for compatibility with existing user codes
134
+ $(document).trigger(
135
+ "rails_admin.dom_ready",
136
+ event.detail ? [event.detail] : null
137
+ );
132
138
  });
133
139
 
134
140
  $(document).on("click", ".bulk-link", function (event) {
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: 3.1.0
4
+ version: 3.1.2
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: 2022-11-06 00:00:00.000000000 Z
15
+ date: 2023-03-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activemodel-serializers-xml
@@ -323,6 +323,7 @@ files:
323
323
  - src/rails_admin/filtering-multiselect.js
324
324
  - src/rails_admin/filtering-select.js
325
325
  - src/rails_admin/i18n.js
326
+ - src/rails_admin/jquery.js
326
327
  - src/rails_admin/nested-form-hooks.js
327
328
  - src/rails_admin/remote-form.js
328
329
  - src/rails_admin/sidescroll.js
@@ -339,8 +340,6 @@ files:
339
340
  - src/rails_admin/widgets.js
340
341
  - vendor/assets/fonts/rails_admin/fa-solid-900.ttf
341
342
  - vendor/assets/fonts/rails_admin/fa-solid-900.woff2
342
- - vendor/assets/images/rails_admin/bootstrap/glyphicons-halflings-white.png
343
- - vendor/assets/images/rails_admin/bootstrap/glyphicons-halflings.png
344
343
  - vendor/assets/javascripts/rails_admin/bootstrap.js
345
344
  - vendor/assets/javascripts/rails_admin/flatpickr-with-locales.js
346
345
  - vendor/assets/javascripts/rails_admin/jquery-ui/data.js