lib/avo/base_action.rb in avo-2.37.2 vs lib/avo/base_action.rb in avo-2.38.0
- old
+ new
@@ -12,10 +12,11 @@
class_attribute :user
class_attribute :resource
class_attribute :standalone, default: false
class_attribute :visible
class_attribute :may_download_file, default: false
+ class_attribute :turbo
attr_accessor :response
attr_accessor :model
attr_accessor :resource
attr_accessor :user
@@ -33,13 +34,13 @@
delegate :context, to: ::Avo::App
def form_data_attributes
# We can't respond with a file download from Turbo se we disable it on the form
if may_download_file
- {turbo: false, remote: false, action_target: :form}
+ {turbo: turbo || false, remote: false, action_target: :form}
else
- {turbo_frame: :_top, action_target: :form}
+ {turbo: turbo, turbo_frame: :_top, action_target: :form}.compact
end
end
# We can't respond with a file download from Turbo se we disable close the modal manually after a while (it's a hack, we know)
def submit_button_data_attributes
@@ -194,11 +195,13 @@
add_message nil, :silent
self
end
- def redirect_to(path = nil, &block)
+ def redirect_to(path = nil, allow_other_host: nil, status: nil, &block)
response[:type] = :redirect
+ response[:allow_other_host] = allow_other_host
+ response[:status] = status
response[:path] = if block.present?
block
else
path
end