avo 3.5.0 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/avo/base_resource.rb +17 -14
- data/lib/avo/concerns/has_controls.rb +1 -1
- data/lib/avo/resources/controls/save_button.rb +4 -1
- data/lib/avo/version.rb +1 -1
- 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: 9baf34b45ec14d817690a0c2a48fc25132b1cce6b80e8b1542b082325d1af656
|
4
|
+
data.tar.gz: f49d287883c66fa87c5ef3cc0be4f307c79ffead8737e25e24bc707ce15d3b2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: debc97692363a7d08ea51571350fea336c9f5201b343e8d2a15e936dbd99685b7b96fb4b74079348846a650eb177a7a008adb1dbebd61140140bd25acfc54704
|
7
|
+
data.tar.gz: 150853cce487de3315d29a66d8f09b837263c4277e7b86c32cc09951e12824e3ed67e9e1adb1d851ac47730199b1c7355a3a333465d5d48ee941476f56b66551
|
data/Gemfile.lock
CHANGED
data/lib/avo/base_resource.rb
CHANGED
@@ -177,24 +177,27 @@ module Avo
|
|
177
177
|
end
|
178
178
|
|
179
179
|
def name
|
180
|
-
default
|
181
|
-
|
182
|
-
if translation_key
|
183
|
-
t(translation_key, count: 1, default: default).humanize
|
184
|
-
else
|
185
|
-
default
|
186
|
-
end
|
180
|
+
name_from_translation_key(count: 1, default: class_name.underscore.humanize)
|
187
181
|
end
|
188
182
|
alias_method :singular_name, :name
|
189
183
|
|
190
184
|
def plural_name
|
191
|
-
default
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
185
|
+
name_from_translation_key(count: 2, default: name.pluralize)
|
186
|
+
end
|
187
|
+
|
188
|
+
# Get the name from the translation_key and fallback to default
|
189
|
+
# It can raise I18n::InvalidPluralizationData when using only resource_translation without pluralization keys like: one, two or other key
|
190
|
+
# Example:
|
191
|
+
# ---
|
192
|
+
# en:
|
193
|
+
# avo:
|
194
|
+
# resource_translations:
|
195
|
+
# product:
|
196
|
+
# save: "Save product"
|
197
|
+
def name_from_translation_key(count:, default:)
|
198
|
+
t(translation_key, count:, default:).humanize
|
199
|
+
rescue I18n::InvalidPluralizationData
|
200
|
+
default
|
198
201
|
end
|
199
202
|
|
200
203
|
def underscore_name
|
@@ -16,7 +16,7 @@ module Avo
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def render_edit_controls
|
19
|
-
[BackButton.new(label: I18n.t("avo.cancel").capitalize), DeleteButton.new, ActionsList.new, SaveButton.new]
|
19
|
+
[BackButton.new(label: I18n.t("avo.cancel").capitalize), DeleteButton.new, ActionsList.new, SaveButton.new(resource: self)]
|
20
20
|
end
|
21
21
|
|
22
22
|
def render_index_controls(item:)
|
data/lib/avo/version.rb
CHANGED
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: 3.5.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-03-
|
13
|
+
date: 2024-03-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|