avo 3.14.3 → 3.14.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,8 +41,14 @@
41
41
  stacked: true,
42
42
  classes: 'w-full'
43
43
  %>
44
- <%= hidden_field_tag :turbo_frame, params[:turbo_frame] %>
45
44
  <% end %>
45
+ <%#
46
+ It is important to render this hidden field to allow selective rendering of the turbo frame.
47
+ (e.g. in the case of "Attach and Attach Another")
48
+
49
+ Without this, the entire page will be reloaded when the form is submitted.
50
+ %>
51
+ <%= hidden_field_tag :turbo_frame, params[:turbo_frame] %>
46
52
  <% @attach_fields&.each_with_index do |field, index| %>
47
53
  <%= render(Avo::Items::SwitcherComponent.new(
48
54
  resource: @related_resource,
@@ -143,6 +143,26 @@ module Avo
143
143
  ).handle
144
144
  end
145
145
 
146
+ def cancel_button_label
147
+ Avo::ExecutionContext.new(
148
+ target: self.class.cancel_button_label,
149
+ resource: @resource,
150
+ record: @record,
151
+ view: @view,
152
+ arguments: @arguments
153
+ ).handle
154
+ end
155
+
156
+ def confirm_button_label
157
+ Avo::ExecutionContext.new(
158
+ target: self.class.confirm_button_label,
159
+ resource: @resource,
160
+ record: @record,
161
+ view: @view,
162
+ arguments: @arguments
163
+ ).handle
164
+ end
165
+
146
166
  def handle_action(**args)
147
167
  processed_fields = if args[:fields].present?
148
168
  # Fetching the field definitions and not the actual fields (get_fields) because they will break if the user uses a `visible` block and adds a condition using the `params` variable. The params are different in the show method and the handle method.
@@ -9,13 +9,15 @@ class Avo::SvgFinder
9
9
 
10
10
  # Use the default static finder logic. If that doesn't find anything, search according to our pattern:
11
11
  def pathname
12
- found_asset = default_strategy
12
+ Avo::CACHED_SVGS[@filename] ||= begin
13
+ found_asset = default_strategy
13
14
 
14
- # Use the found asset
15
- return found_asset if found_asset.present?
15
+ # Use the found asset
16
+ return found_asset if found_asset.present?
16
17
 
17
- paths.find do |path|
18
- File.exist? path
18
+ paths.find do |path|
19
+ File.exist? path
20
+ end
19
21
  end
20
22
  end
21
23
 
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.14.3" unless const_defined?(:VERSION)
2
+ VERSION = "3.14.5" unless const_defined?(:VERSION)
3
3
  end
data/lib/avo.rb CHANGED
@@ -19,6 +19,7 @@ module Avo
19
19
  COOKIES_KEY = "avo"
20
20
  MODAL_FRAME_ID = :modal_frame
21
21
  ACTIONS_BACKGROUND_FRAME = :actions_background
22
+ CACHED_SVGS = {}
22
23
 
23
24
  class LicenseVerificationTemperedError < StandardError; end
24
25
 
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.14.3
4
+ version: 3.14.5
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-11-22 00:00:00.000000000 Z
13
+ date: 2024-11-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord