rails_admin_next 3.0.1 → 3.0.3
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/README.md +5 -5
- data/app/controllers/rails_admin_next/application_controller.rb +1 -1
- data/docs/UPGRADING.md +11 -1
- data/docs/upstream-parity.md +1 -1
- data/lib/rails_admin_next/config/actions/base.rb +5 -0
- data/lib/rails_admin_next/config/actions/history_index.rb +4 -0
- data/lib/rails_admin_next/config/actions/history_show.rb +4 -0
- data/lib/rails_admin_next/extensions/paper_trail/auditing_adapter.rb +11 -1
- data/lib/rails_admin_next/version.rb +3 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b60264fae786d77342d86613643cb7e68bf01c3c95213433fb54c137b7355585
|
|
4
|
+
data.tar.gz: e8e63e7db2458e557b84e892fd62846d2fefee72bfe1a2069d09f8f21adcbe97
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a2c7a568d3c2fc5650c7da0b6832f9322b932f31dadc70bf0c5aecb1f45a1faca85a3bd633b1c4e5d60da1ed1a29beba0ca5b1f7c52c60ec360d3c0a17969f5
|
|
7
|
+
data.tar.gz: 25b96098b8cb721295d1b7b6b5534aa2822022de5a06cc37ac0ee8b955c4c0968287b9f20984a0b4681bd0d759d5bdcd4f374b8c60fd409b065fccf17d044566
|
data/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
**Rails ~> 8.1 · ActiveRecord · importmap + Propshaft · Turbo + Stimulus · zero build step**
|
|
8
8
|
|
|
9
|
-
[](https://github.com/6temes/rails_admin_next/actions/workflows/ci.yml)
|
|
10
10
|
[](LICENSE.md)
|
|
11
|
-
[](https://www.ruby-lang.org)
|
|
12
12
|
[](https://rubyonrails.org)
|
|
13
13
|
|
|
14
14
|
[Why RailsAdminNext?](#why-railsadminnext) ◆ [Quick Start](#quick-start) ◆ [Installation](#installation) ◆ [Architecture](#architecture) ◆ [Security](#security) ◆ [Upgrading](#upgrading-from-railsadmin)
|
|
@@ -32,7 +32,7 @@ multi-bundler, jQuery-era machinery. RailsAdminNext keeps the admin and drops th
|
|
|
32
32
|
- **⚡ Zero build step** — browser-native ESM over **importmap + Propshaft**; no Webpack/Vite/Sprockets, no `yarn build`, no generated pins.
|
|
33
33
|
- **🧩 Turbo + Stimulus** — the jQuery / jQuery-UI / Bootstrap-JS / `@rails/ujs` stack is gone, replaced by engine-shipped Stimulus controllers; styling is hand-maintained vanilla CSS.
|
|
34
34
|
- **🔒 Hardened & CDN-free** — a documented CSRF / clickjacking / mass-assignment / CSP posture ([SECURITY.md](SECURITY.md)) and **zero external CDN**, default or opt-in — every asset is self-hosted off a gem.
|
|
35
|
-
- **🎯 One modern target** — Ruby ≥ 4.0.
|
|
35
|
+
- **🎯 One modern target** — Ruby ≥ 4.0.10, Rails ~> 8.1, ActiveRecord only, latest Chrome + Safari. No Mongoid, no multi-bundler / multi-Rails matrix, no legacy-browser CSS.
|
|
36
36
|
- **↩️ Familiar** — `RailsAdminNext.config`, per-model `rails_admin_next do … end` blocks, and Pundit authorization all work as before; upgrading from RailsAdmin is a mechanical rename.
|
|
37
37
|
|
|
38
38
|
## Quick Start
|
|
@@ -50,11 +50,11 @@ bin/rails s # then open http://localhost:3000/admin
|
|
|
50
50
|
|
|
51
51
|
That's the whole setup — no `yarn add`, no asset build, no generated pins. The engine ships its own importmap and CSS.
|
|
52
52
|
|
|
53
|
-
> **Prerequisites:** Ruby ≥ 4.0.
|
|
53
|
+
> **Prerequisites:** Ruby ≥ 4.0.10 · Rails ~> 8.1 · ActiveRecord · a [Propshaft][propshaft] + [importmap-rails][importmap] host (both are pulled in as dependencies). See [Installation](#installation) for the full walkthrough.
|
|
54
54
|
|
|
55
55
|
## Requirements
|
|
56
56
|
|
|
57
|
-
- Ruby >= 4.0.
|
|
57
|
+
- Ruby >= 4.0.10
|
|
58
58
|
- Rails ~> 8.1
|
|
59
59
|
- ActiveRecord (Mongoid is not supported)
|
|
60
60
|
- [Propshaft][propshaft] and [importmap-rails][importmap] (both are pulled in as
|
|
@@ -24,7 +24,7 @@ module RailsAdminNext
|
|
|
24
24
|
|
|
25
25
|
helper_method :_current_user
|
|
26
26
|
|
|
27
|
-
attr_reader :object, :model_config, :abstract_model, :authorization_adapter
|
|
27
|
+
attr_reader :object, :model_config, :abstract_model, :auditing_adapter, :authorization_adapter
|
|
28
28
|
|
|
29
29
|
# nil without an authorization adapter. With one, a scope that is not a relation (nil, a
|
|
30
30
|
# Hash, a Proc, an Array) comes from a broken policy and lists nothing: merged in, most of
|
data/docs/UPGRADING.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Upgrading from rails_admin to rails_admin_next
|
|
2
2
|
|
|
3
|
-
`rails_admin_next` is the modernized fork of `rails_admin`: Rails 8.1 / Ruby 4.0 floor,
|
|
3
|
+
`rails_admin_next` is the modernized fork of `rails_admin`: Rails 8.1 / Ruby 4.0.10 floor,
|
|
4
4
|
ActiveRecord only, an importmap + Propshaft asset pipeline, a Stimulus + Turbo
|
|
5
5
|
frontend (no jQuery, jQuery-UI, Bootstrap JS, or `@rails/ujs`), vanilla CSS with a
|
|
6
6
|
latest-Chrome/Safari browser floor, and a hardened security posture. This guide covers
|
|
@@ -913,3 +913,13 @@ A `last_created_at` override in model config is not scoped for you. It runs with
|
|
|
913
913
|
`bindings[:controller].authorization_scope(:index, abstract_model)`: the authorized relation, an
|
|
914
914
|
empty one when the policy scope is broken, or `nil` without an authorization adapter. Calling the
|
|
915
915
|
adapter's `query` directly skips that check.
|
|
916
|
+
|
|
917
|
+
## History is hidden for a model PaperTrail does not version
|
|
918
|
+
|
|
919
|
+
With `config.audit_with :paper_trail`, a model without `has_paper_trail` no longer shows History
|
|
920
|
+
links, and its history pages list no versions. They used to fail with `NoMethodError`.
|
|
921
|
+
|
|
922
|
+
An auditing adapter may define `auditable?(abstract_model)`. When it answers false, the
|
|
923
|
+
`history_index` and `history_show` actions are hidden for that model. A custom adapter that does
|
|
924
|
+
not define it keeps the History links on every model, as before. A `visible` block you configure
|
|
925
|
+
on either history action replaces this check.
|
data/docs/upstream-parity.md
CHANGED
|
@@ -75,7 +75,7 @@ Commits are listed newest first, as `git log` reports them.
|
|
|
75
75
|
| `2eed28e1` | Fully specify all ESM imports with an extension | n/a — measured: every relative import in `src/` already carries `.js`; browser-native ESM requires it | — |
|
|
76
76
|
| `e8dec57a` | Upgrade @hotwired/turbo-rails to resolve security warning | n/a — turbo comes from the `turbo-rails` gem (2.0.23), which Dependabot reads | — |
|
|
77
77
|
| `07b2066a` | Replace `asset-url` with `url` in Sass files | n/a — no Sass; one hand-owned CSS file | — |
|
|
78
|
-
| `a0946615` | Drop support for Rails 6.x and Ruby 2.5/2.6 | n/a — this fork is Rails ~> 8.1 / Ruby >= 4.0.
|
|
78
|
+
| `a0946615` | Drop support for Rails 6.x and Ruby 2.5/2.6 | n/a — this fork is Rails ~> 8.1 / Ruby >= 4.0.10 only | — |
|
|
79
79
|
| `0543cb3f` | Revert npm package.json version ahead of actual publish | n/a — no npm package | — |
|
|
80
80
|
| `cf7b112e` | Run Prettier on migrated docs | n/a — upstream's vendored wiki | — |
|
|
81
81
|
| `1c2b92a3` | Rewrite wiki cross-links to relative docs/ links | n/a — upstream's vendored wiki | — |
|
|
@@ -58,6 +58,11 @@ module RailsAdminNext
|
|
|
58
58
|
)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
def auditable?
|
|
62
|
+
adapter = bindings[:controller].try(:auditing_adapter)
|
|
63
|
+
bindings[:abstract_model].nil? || !adapter.respond_to?(:auditable?) || adapter.auditable?(bindings[:abstract_model])
|
|
64
|
+
end
|
|
65
|
+
|
|
61
66
|
# Is the action acting on the root level (Example: /admin/contact)
|
|
62
67
|
register_instance_option :root? do
|
|
63
68
|
false
|
|
@@ -114,6 +114,12 @@ module RailsAdminNext
|
|
|
114
114
|
.collect { |version| VersionProxy.new(version, user_class) }
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
# Optional in the auditing adapter contract: the history actions hide themselves for a model
|
|
118
|
+
# whose adapter answers false, and stay visible for an adapter that does not define it.
|
|
119
|
+
def auditable?(abstract_model)
|
|
120
|
+
versioned?(abstract_model.model)
|
|
121
|
+
end
|
|
122
|
+
|
|
117
123
|
def delete_object(_object, _model, _user)
|
|
118
124
|
# do nothing
|
|
119
125
|
end
|
|
@@ -146,7 +152,11 @@ module RailsAdminNext
|
|
|
146
152
|
sort_by
|
|
147
153
|
end
|
|
148
154
|
|
|
149
|
-
versions =
|
|
155
|
+
versions =
|
|
156
|
+
if !auditable?(model) then version_class.none
|
|
157
|
+
elsif object.nil? then versions_for_model(model, scope)
|
|
158
|
+
else object.public_send(model.model.versions_association_name)
|
|
159
|
+
end
|
|
150
160
|
versions = versions.where("event LIKE ?", "%#{query}%") if query.present?
|
|
151
161
|
versions = versions.reorder(sort)
|
|
152
162
|
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module RailsAdminNext
|
|
4
4
|
class Version
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# the floor a local `gem build` produces.
|
|
5
|
+
# The release workflow stamps the tag's version over these constants before
|
|
6
|
+
# building (bin/stamp-version), so they are never bumped by hand.
|
|
8
7
|
MAJOR = 3
|
|
9
8
|
MINOR = 0
|
|
10
|
-
PATCH =
|
|
9
|
+
PATCH = 3
|
|
11
10
|
PRE = nil
|
|
12
11
|
|
|
13
12
|
class << self
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_admin_next
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel López Prat
|
|
@@ -340,7 +340,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
340
340
|
requirements:
|
|
341
341
|
- - ">="
|
|
342
342
|
- !ruby/object:Gem::Version
|
|
343
|
-
version: 4.0.
|
|
343
|
+
version: 4.0.10
|
|
344
344
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
345
|
requirements:
|
|
346
346
|
- - ">="
|