avo 4.2.1 → 4.2.2
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.lock +1 -1
- data/app/assets/builds/avo.base.css +12609 -0
- data/app/assets/builds/avo.base.js +166402 -0
- data/app/assets/builds/avo.base.js.map +7 -0
- data/app/assets/builds/avo.custom.js +6 -0
- data/app/assets/builds/avo.custom.js.map +7 -0
- data/app/assets/builds/late-registration.js +10 -0
- data/app/assets/builds/late-registration.js.map +7 -0
- data/app/components/avo/fields/date_time_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/time_field/index_component.html.erb +1 -1
- data/app/controllers/avo/actions_controller.rb +12 -0
- data/app/controllers/avo/associations_controller.rb +8 -0
- data/lib/avo/resources/base.rb +7 -0
- data/lib/avo/skills/avo-actions/SKILL.md +1 -0
- data/lib/avo/skills/avo-associations/SKILL.md +1 -1
- data/lib/avo/skills/avo-i18n/SKILL.md +3 -0
- data/lib/avo/skills/avo-resources/SKILL.md +3 -1
- data/lib/avo/skills/avo-update/SKILL.md +1 -1
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +12 -0
- metadata +8 -1
|
@@ -74,8 +74,11 @@ es:
|
|
|
74
74
|
zero: "usuarios"
|
|
75
75
|
one: "usuario"
|
|
76
76
|
other: "usuarios"
|
|
77
|
+
description: "Los usuarios de la aplicación"
|
|
77
78
|
```
|
|
78
79
|
|
|
80
|
+
`description` fills the resource's panel description and, per the cascade, beats `self.description` on the class.
|
|
81
|
+
|
|
79
82
|
Omit `self.translation_key` and Avo derives it from the class name, **namespace included** — `Avo::Resources::Galaxy::Planet` defaults to `avo.resource_translations.galaxy/planet`. So for a plain resource you often only need the YAML, no Ruby change.
|
|
80
83
|
|
|
81
84
|
### 3. Localize an action
|
|
@@ -119,6 +119,8 @@ class Avo::Resources::User < Avo::BaseResource
|
|
|
119
119
|
end
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
+
Avo also resolves `description` below the resource's translation key — `avo.resource_translations.user.description` supplies the User resource description. Per the cascade, the locale file **wins** and `self.description` is the fallback, so an app can keep an English default in code and translate over it — **avo-i18n**.
|
|
123
|
+
|
|
122
124
|
- `self.description` is rendered as **raw HTML** — never feed it user-editable data (stored-XSS risk). A block gets `record`, `resource`, `view`, `current_user`, `params`.
|
|
123
125
|
- `self.color` takes a Symbol or String from Avo's palette — `red`, `orange`, `amber`, `yellow`, `lime`, `green`, `emerald`, `teal`, `cyan`, `sky`, `blue`, `indigo`, `violet`, `purple`, `fuchsia`, `pink`, `rose`. It tints the icon **stroke only** (label and hover/active backgrounds stay neutral), adapts to light and dark themes, and an unknown name silently renders the neutral icon. The tint follows the resource to its breadcrumb initials chip and, with Advanced Search installed, to the resource group headers in global search results. A `color:` on the menu entry overrides it.
|
|
124
126
|
- `self.cover`/`self.avatar` were named `cover_photo`/`profile_photo` in Avo 3. A **Symbol** `source:` renders nothing for unpersisted (new) records — use a block if you want a placeholder on `new`/`index`.
|
|
@@ -260,7 +262,7 @@ Search (`self.search`), grid/map view types, record reordering, and i18n live on
|
|
|
260
262
|
- **Two resources, one model → wrong one wins.** Avo resolves the default alphabetically. Set `config.model_resource_mapping` and/or `use_resource:` on associations.
|
|
261
263
|
- **Secondary / namespaced / oddly-named resources need `self.model_class`** (or the matching namespace) or Avo can't infer the model. Namespaced resources whose namespace matches the model's namespace infer automatically.
|
|
262
264
|
- **Array resources are Beta:** no sorting, and `records` re-runs every request. Cache inside `records` for large sets, or move to an HTTP Resource.
|
|
263
|
-
- **`find_record_method` in batch contexts:** `id` arrives as an Array for bulk actions — return a collection (`query.where(...)`) in that branch, not a single record.
|
|
265
|
+
- **`find_record_method` in batch contexts:** `id` arrives as an Array for bulk actions — return a collection (`query.where(...)`) in that branch, not a single record. If that branch raises `ActiveRecord::RecordNotFound` (as `query.find(id)` does when one record was deleted between selection and submit), Avo retries the **scalar** branch once per id and drops the ones that are gone — so keep the scalar branch able to handle every id the array branch receives.
|
|
264
266
|
- **`visible_on_sidebar` only affects the auto-generated menu.** If the app uses the menu editor, control visibility in its `visible` block instead.
|
|
265
267
|
- **Don't re-invent fields/associations here.** Field DSL is the avo-fields skill; `belongs_to`/`has_many`/`use_resource` is avo-associations.
|
|
266
268
|
- **Verify before writing.** Option names drift between versions — check the docs URLs above or the app's installed Avo source rather than trusting memory.
|
|
@@ -163,7 +163,7 @@ Check the project's own instructions for how — in this order: `AGENTS.md`, `CL
|
|
|
163
163
|
- **The update alone is not the upgrade.** Bumping the gems and skipping the guide is the single most common way an admin breaks after an "upgrade" — and the breakage often surfaces days later, in a view nobody opened.
|
|
164
164
|
- **Apply sections oldest → newest.** They're written as a chain; applying 4.0.12's change before 4.0.7's can leave you editing code the earlier section was about to rename.
|
|
165
165
|
- **Silent default flips pass tests.** Sections that change a default (authorization strictness, confirmation modals, expanded filters) break nothing visible in CI and change runtime behavior. Call these out individually.
|
|
166
|
-
- **A section can be triggered by the app's locale files, not its Ruby.** Avo has been moving label resolution so a derived i18n key wins *over* the class attribute — actions in `4.0.17`, then cards, dashboards and scopes in `avo-dashboards` / `avo-scopes` `4.1.2`. Nothing in the app's Ruby changed, so grepping for an API name finds nothing; the trigger is a key the app already defines under `avo.action_translations`, `avo.card_translations`, `avo.dashboard_translations` or `avo.
|
|
166
|
+
- **A section can be triggered by the app's locale files, not its Ruby.** Avo has been moving label resolution so a derived i18n key wins *over* the class attribute — actions in `4.0.17`, then cards, dashboards and scopes in `avo-dashboards` / `avo-scopes` `4.1.2`, then resource descriptions in `4.2.2`. Nothing in the app's Ruby changed, so grepping for an API name finds nothing; the trigger is a key the app already defines under `avo.action_translations`, `avo.card_translations`, `avo.dashboard_translations`, `avo.scope_translations`, or `avo.resource_translations.<resource>.description`. Where one exists the class attribute stops being read **even when it's a lambda**, which is then never called and computes nothing, with no error. Grep those roots in `config/locales`, and move the collision with `self.translation_key` (or a value at the registration site) rather than deleting the key — **avo-i18n**.
|
|
167
167
|
- **Add-on gems version independently.** `avo-kanban 0.1.17 → 0.1.18` has its own section even when Avo core barely moved. Work the lock diff, not just the core version.
|
|
168
168
|
- **Assets after upgrade.** A GitHub-sourced install ships no precompiled assets — re-run `rake avo:build-assets` or the admin renders unstyled (**avo-setup**).
|
|
169
169
|
- **Don't invent a migration.** If a version's change isn't in the guide or the release notes, stop and ask rather than guessing at the new API.
|
data/lib/avo/version.rb
CHANGED
data/lib/avo.rb
CHANGED
|
@@ -102,6 +102,18 @@ module Avo
|
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
+
# Exception raised when an association field has no matching model association.
|
|
106
|
+
class MissingAssociationError < StandardError
|
|
107
|
+
def initialize(model_class, association_name, field)
|
|
108
|
+
macro = field.type.to_s
|
|
109
|
+
super(
|
|
110
|
+
"Failed to find the :#{association_name} association on #{model_class} while rendering the :#{field.id} field.\n" \
|
|
111
|
+
"Define `#{macro} :#{association_name}` on #{model_class}, or update the Avo field to use an association that exists.\n" \
|
|
112
|
+
"More info on https://docs.avohq.io/#{Avo::VERSION[0]}.0/associations.html."
|
|
113
|
+
)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
105
117
|
class ResourceNotFoundError < StandardError
|
|
106
118
|
def initialize(resource_name)
|
|
107
119
|
super(
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.2.
|
|
4
|
+
version: 4.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adrian Marin
|
|
@@ -221,6 +221,11 @@ files:
|
|
|
221
221
|
- Gemfile.lock
|
|
222
222
|
- README.md
|
|
223
223
|
- Rakefile
|
|
224
|
+
- app/assets/builds/avo.base.css
|
|
225
|
+
- app/assets/builds/avo.base.js
|
|
226
|
+
- app/assets/builds/avo.base.js.map
|
|
227
|
+
- app/assets/builds/avo.custom.js
|
|
228
|
+
- app/assets/builds/avo.custom.js.map
|
|
224
229
|
- app/assets/builds/avo/application.css
|
|
225
230
|
- app/assets/builds/avo/application.js
|
|
226
231
|
- app/assets/builds/avo/application.js.map
|
|
@@ -229,6 +234,8 @@ files:
|
|
|
229
234
|
- app/assets/builds/avo/dependencies.css
|
|
230
235
|
- app/assets/builds/avo/late-registration.js
|
|
231
236
|
- app/assets/builds/avo/late-registration.js.map
|
|
237
|
+
- app/assets/builds/late-registration.js
|
|
238
|
+
- app/assets/builds/late-registration.js.map
|
|
232
239
|
- app/assets/config/avo_manifest.js
|
|
233
240
|
- app/assets/images/avo/favicon-dark.ico
|
|
234
241
|
- app/assets/images/avo/favicon.ico
|