avo 3.19.2 → 3.19.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/Gemfile.lock +1 -1
- data/app/assets/builds/avo.base.js +70 -50
- data/app/assets/builds/avo.base.js.map +3 -3
- data/lib/avo/engine.rb +1 -1
- data/lib/avo/fields/base_field.rb +28 -30
- data/lib/avo/fields/heading_field.rb +1 -1
- data/lib/avo/version.rb +1 -1
- metadata +2 -2
data/lib/avo/engine.rb
CHANGED
@@ -70,18 +70,19 @@ module Avo
|
|
70
70
|
@summarizable = args[:summarizable] || false
|
71
71
|
@nullable = args[:nullable] || false
|
72
72
|
@null_values = args[:null_values] || [nil, ""]
|
73
|
-
@format_using = args[:format_using]
|
74
|
-
@update_using = args[:update_using]
|
73
|
+
@format_using = args[:format_using]
|
74
|
+
@update_using = args[:update_using]
|
75
|
+
@decorate = args[:decorate]
|
75
76
|
@placeholder = args[:placeholder]
|
76
|
-
@autocomplete = args[:autocomplete]
|
77
|
-
@help = args[:help]
|
78
|
-
@default = args[:default]
|
77
|
+
@autocomplete = args[:autocomplete]
|
78
|
+
@help = args[:help]
|
79
|
+
@default = args[:default]
|
79
80
|
@visible = args[:visible]
|
80
81
|
@as_avatar = args[:as_avatar] || false
|
81
|
-
@html = args[:html]
|
82
|
-
@view = Avo::ViewInquirer.new(args[:view])
|
83
|
-
@value = args[:value]
|
84
|
-
@stacked = args[:stacked]
|
82
|
+
@html = args[:html]
|
83
|
+
@view = Avo::ViewInquirer.new(args[:view])
|
84
|
+
@value = args[:value]
|
85
|
+
@stacked = args[:stacked]
|
85
86
|
@for_presentation_only = args[:for_presentation_only] || false
|
86
87
|
@resource = args[:resource]
|
87
88
|
@action = args[:action]
|
@@ -154,45 +155,42 @@ module Avo
|
|
154
155
|
def value(property = nil)
|
155
156
|
return @value if @value.present?
|
156
157
|
|
157
|
-
property ||= @for_attribute || id
|
158
|
+
property ||= @for_attribute || @id
|
158
159
|
|
159
160
|
# Get record value
|
160
|
-
final_value = record.send(property) if is_model?(record) && record.respond_to?(property)
|
161
|
+
final_value = @record.send(property) if is_model?(@record) && @record.respond_to?(property)
|
161
162
|
|
162
163
|
# On new views and actions modals we need to prefill the fields with the default value if value is nil
|
163
|
-
if final_value.nil? && should_fill_with_default_value? && default.present?
|
164
|
+
if final_value.nil? && should_fill_with_default_value? && @default.present?
|
164
165
|
final_value = computed_default_value
|
165
166
|
end
|
166
167
|
|
167
168
|
# Run computable callback block if present
|
168
|
-
if computable && block.present?
|
169
|
-
final_value =
|
169
|
+
if computable && @block.present?
|
170
|
+
final_value = execute_context(@block)
|
170
171
|
end
|
171
172
|
|
172
173
|
# Run the value through resolver if present
|
173
|
-
if format_using.present?
|
174
|
-
final_value =
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
view: view,
|
180
|
-
field: self,
|
181
|
-
include: self.class.included_modules
|
182
|
-
).handle
|
174
|
+
if @format_using.present?
|
175
|
+
final_value = execute_context(@format_using, value: final_value)
|
176
|
+
end
|
177
|
+
|
178
|
+
if @decorate.present? && @view.display?
|
179
|
+
final_value = execute_context(@decorate, value: final_value)
|
183
180
|
end
|
184
181
|
|
185
182
|
final_value
|
186
183
|
end
|
187
184
|
|
188
|
-
def
|
185
|
+
def execute_context(target, **extra_args)
|
189
186
|
Avo::ExecutionContext.new(
|
190
|
-
target
|
191
|
-
record: record,
|
192
|
-
resource: resource,
|
193
|
-
view: view,
|
187
|
+
target:,
|
188
|
+
record: @record,
|
189
|
+
resource: @resource,
|
190
|
+
view: @view,
|
194
191
|
field: self,
|
195
|
-
include: self.class.included_modules
|
192
|
+
include: self.class.included_modules,
|
193
|
+
**extra_args
|
196
194
|
).handle
|
197
195
|
end
|
198
196
|
|
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.19.
|
4
|
+
version: 3.19.3
|
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: 2025-04-
|
13
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|