thecore_ui_rails_admin 3.7.0 → 3.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50e80608e69b0ee8cfd136957a049fa919a6b332310d89c6c7122e6c35b09444
4
- data.tar.gz: 30dd4923a3702ce54f4f223fddea9b9f29c327d768b8d46174bcdaff09121847
3
+ metadata.gz: 68bdc2c266f2da01e7c620cad865a2a41960dd7be738643d8a97bb52e09bc164
4
+ data.tar.gz: 60447392948bb9d54f028b2a8eb19d7fd5e8664e1202959de8ad0390cafcf55f
5
5
  SHA512:
6
- metadata.gz: 7131d117f2d46e39b1a5cb7935e01ed5e0aa2307bb87bf76c4f174db009726cc4be0ca8cb9508d068716d0aa908811461e090411b5c3a6dcbdc8d314afdca9a2
7
- data.tar.gz: 93a7655e5c9aea60c1eeb3157177066728dc1e98660711301a797d2d2899d5cb92e203ed135e3a43bd206b739362281b2c2068b2b1b036e680d7c54f382dd257
6
+ metadata.gz: 4230e1a6cb30a8af5bca7ef1424c862ff8d235be31d17f6fa86163c12e3940d089e2b11cfe169021c3bed18ea576e3b932b85f05719319868267707b4e7733d1
7
+ data.tar.gz: ade89d04b3ab490a86c8753cb92c8a560ea2fe9da16248ffbcb8c30c9ac1251f13f7955bd386db9cc627b0d9c31fdc91832fb2ddcd0968cf3a5efaa12f16d452
data/README.md CHANGED
@@ -2,6 +2,41 @@ This is part of [Thecore framework](https://github.com/gabrieletassoni/thecore/t
2
2
 
3
3
  ---
4
4
 
5
+ ## Default `navigation_label`/icon for models without a `RailsAdmin::ModelName` concern
6
+
7
+ Per [ADR 0001](https://github.com/gabrieletassoni/thecore/blob/release/3/docs/adr/0001-application-record-defaults-over-generated-concerns.md)
8
+ (host app), any `ApplicationRecord` subclass that does **not** define its own
9
+ `RailsAdmin::ModelName` concern still gets a sensible `navigation_label` and
10
+ a real default icon (`fa fa-table`) in the RailsAdmin sidebar, instead of
11
+ falling back to RailsAdmin's own unconfigured default (no group / no icon).
12
+
13
+ This is provided by `ThecoreUiRailsAdminDefaultNavigationConcern`
14
+ (`config/initializers/concern_default_navigation.rb`), registered into
15
+ [`ThecoreBackendCommons::DefaultModuleRegistry`](../thecore_backend_commons/README.md)
16
+ so it is included automatically into every model at class-definition time —
17
+ no generated concern file required.
18
+
19
+ The default `navigation_label` reuses the exact same i18n key
20
+ (`I18n.t('admin.registries.label')`) that the Thecore VS Code extension's
21
+ `addModel` command already hardcodes into every freshly generated
22
+ `RailsAdmin::ModelName` concern, so a model relying on this default reads
23
+ identically, to an end user, to one whose generated-and-never-customized
24
+ concern was kept around.
25
+
26
+ **Field-level configuration is never defaulted** — `hide`, `sticky`,
27
+ `configure :field`, custom `list`/`edit` blocks, etc. stay exclusively in
28
+ hand-written `RailsAdmin::ModelName` concerns. A model that already has its
29
+ own concern is unaffected: its own `navigation_label`/`navigation_icon` (if
30
+ set) and all field-level config still win over/apply alongside the default.
31
+
32
+ > **Temporary dependency note**: this feature requires
33
+ > `ThecoreBackendCommons::DefaultModuleRegistry`, merged into
34
+ > `thecore_backend_commons`'s `release/3` branch but not yet published to
35
+ > RubyGems. The `Gemfile` pins a git source for this
36
+ > (`github: "gabrieletassoni/thecore_backend_commons", branch: "release/3"`)
37
+ > until a real release ships — remove it once `thecore_backend_commons`
38
+ > cuts a version satisfying the gemspec's `>= 3.4` constraint.
39
+
5
40
  ## Push Notification Test (RailsAdmin root action)
6
41
 
7
42
  A built-in admin UI for sending Web Push test notifications. It lets you pick one or more active subscribers and fire a real notification immediately — useful for verifying the end-to-end VAPID setup without writing any code.
@@ -0,0 +1,64 @@
1
+ require 'active_support/concern'
2
+
3
+ # Default RailsAdmin `navigation_label`/`navigation_icon` for any
4
+ # `ApplicationRecord` subclass that has no explicit `RailsAdmin::ModelName`
5
+ # concern of its own -- see ADR 0001
6
+ # (vendor/external/thecore/docs/adr/0001-application-record-defaults-over-generated-concerns.md
7
+ # in the host app) and GitHub issue
8
+ # gabrieletassoni/thecore_ui_rails_admin#7.
9
+ #
10
+ # Registered into `ThecoreBackendCommons::DefaultModuleRegistry` below, so
11
+ # it is `include`d automatically into every model at class-definition time
12
+ # (via `ApplicationRecord.inherited`) instead of requiring a per-model
13
+ # `RailsAdmin::ModelName` concern file to be generated just to get these two
14
+ # mechanically-derivable values.
15
+ #
16
+ # Deliberately does NOT default any field-level configuration (`hide`,
17
+ # `sticky`, `configure :field`, custom `list`/`edit` blocks, ...) -- per
18
+ # ADR 0001's research, every existing hand-written `RailsAdmin::ModelName`
19
+ # concern in the `mytask` engine carries real field-level content, so only
20
+ # the navigation bits below are safe to default. Field-level config stays
21
+ # exclusively in hand-written concerns.
22
+ #
23
+ # `navigation_label` intentionally reuses the exact SAME fixed i18n key
24
+ # (`I18n.t('admin.registries.label')`) that the Thecore VS Code extension's
25
+ # `addModel` template
26
+ # (vendor/external/thecore_code_extension/templates/addModel/rails_admin_concern.rb
27
+ # in the host app) already hardcodes into every freshly generated
28
+ # `RailsAdmin::ModelName` concern -- so a model relying on this default
29
+ # looks, to an end user, exactly like one whose generated-and-never-customized
30
+ # concern was kept around. `DEFAULT_ICON` is a real, ready-to-use FontAwesome
31
+ # icon (no "TODO: customize" placeholder needed).
32
+ #
33
+ # == Why an explicit concern's own `navigation_label`/`navigation_icon` wins
34
+ #
35
+ # This module is `include`d into a model class from
36
+ # `ApplicationRecord.inherited`, which fires -- and so evaluates this
37
+ # `included do rails_admin do ... end end` block, registering RailsAdmin's
38
+ # *first* deferred config block for that model -- before the model class
39
+ # body itself runs its own `include RailsAdmin::ModelName` statement, whose
40
+ # block is registered *second*. RailsAdmin evaluates same-origin deferred
41
+ # blocks in registration order (see
42
+ # `RailsAdmin::Config::LazyModel#target` in the `rails_admin` gem), and
43
+ # `navigation_label`/`navigation_icon` are plain last-write-wins setters
44
+ # (see `RailsAdmin::Config::Configurable::ClassMethods#register_instance_option`),
45
+ # so whichever call runs last -- the hand-written concern's, when present --
46
+ # overrides the default set here.
47
+ module ThecoreUiRailsAdminDefaultNavigationConcern
48
+ extend ActiveSupport::Concern
49
+
50
+ DEFAULT_ICON = 'fa fa-table'.freeze
51
+
52
+ included do
53
+ rails_admin do
54
+ navigation_label I18n.t('admin.registries.label')
55
+ navigation_icon ThecoreUiRailsAdminDefaultNavigationConcern::DEFAULT_ICON
56
+ end
57
+ end
58
+ end
59
+
60
+ Rails.application.config.to_prepare do
61
+ ThecoreBackendCommons::DefaultModuleRegistry.register(
62
+ ThecoreUiRailsAdminDefaultNavigationConcern
63
+ )
64
+ end
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiRailsAdmin
2
- VERSION = "3.7.0".freeze
2
+ VERSION = "3.8.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_rails_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
@@ -51,6 +51,20 @@ dependencies:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '1.18'
54
+ - !ruby/object:Gem::Dependency
55
+ name: thecore_backend_commons
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '3.4'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '3.4'
54
68
  description: Holds all base dependencies and configurations to have a thecore integrated
55
69
  with Rails Admin.
56
70
  email:
@@ -103,6 +117,7 @@ files:
103
117
  - config/initializers/assets.rb
104
118
  - config/initializers/concern_action.rb
105
119
  - config/initializers/concern_bulk_delete.rb
120
+ - config/initializers/concern_default_navigation.rb
106
121
  - config/initializers/concern_export.rb
107
122
  - config/initializers/concern_permission.rb
108
123
  - config/initializers/concern_permission_role.rb