avo 2.37.1 → 2.38.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23ddc6ba1d200de7c9597eb8aeb0d52b82f18f9321d859dd4f2089dfc11e7991
4
- data.tar.gz: 8825e4520ec2c6792c3b34de9be0658cc13e4fa13bdd15e1c2930719ae98391a
3
+ metadata.gz: a558c52541dd75426ebf2d447ec7b423e5301c33cf8abfd0dbda7d7cdab6b485
4
+ data.tar.gz: 551a3646a7a41e9563bd3dbe04e88ef3b4fceb9705a232e7d410225d7eec55c2
5
5
  SHA512:
6
- metadata.gz: 9e0d26ced1c8bbfdb1d1c29a90e8c11ff86e038d58f985f06b2241888416b1c2d4ab13a8179229bcf39af94861b591804616312342e06ed069cd1bbdb6fb4f21
7
- data.tar.gz: b2be4690bf39bee8d27fa064393b91431b38476022610e084e5f625890abd563669009d043ca9b56f57c21671ecb7c63eb7040629b3bc23c5b501b1429ff1c71
6
+ metadata.gz: 92737e15eb5e98a99b55a6c3ae8ba3ed6f332ed79dd0729fcbb977663fa9e1e76b54403a60375870786779f19f9bb82049d21f5a8c40e1e17452a5ec7b7e9e80
7
+ data.tar.gz: 42e16af631e5709b72b5a28e1a7702595f82dac447a61d923e4c26bdc8c26cc25f1d8453ba5d3d74dffe074dccdc5a59f94909e6a3987afeb2303baf23fc4280
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.37.1)
4
+ avo (2.38.0)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -3,7 +3,7 @@
3
3
  data-modal-target="modal"
4
4
  >
5
5
  <div aria-expanded="true" class="modal-overlay absolute w-full h-full bg-opacity-25 bg-gray-800 flex justify-center items-center" data-action="click->modal#close"></div>
6
- <div aria-expanded="true" role="dialog" aria-modal="true" class="modal-body rounded-lg overflow-hidden inset-auto w-11/12 lg:w-1/2 sm:max-w-168 min-h-1/4 bg-white flex z-50 relative shadow-modal">
6
+ <div aria-expanded="true" role="dialog" aria-modal="true" class="modal-body rounded-lg inset-auto w-11/12 lg:w-1/2 sm:max-w-168 min-h-1/4 bg-white flex z-50 relative shadow-modal overflow-auto max-h-full">
7
7
  <div class="flex-1 flex flex-col justify-between">
8
8
  <div>
9
9
  <div class="p-6 text-2xl tracking-normal font-semibold text-black">
@@ -151,9 +151,11 @@ class Avo::ResourceComponent < Avo::BaseComponent
151
151
 
152
152
  inverse_of = current_reflection.inverse_of
153
153
 
154
- if inverse_of.blank?
155
- # Please configure the 'inverse_of' option for the ':users' association on the 'Project' model.
156
- raise "Please configure the 'inverse_of' option for the '#{current_reflection.macro} :#{current_reflection.name}' association on the '#{current_reflection.active_record.name}' model."
154
+ if inverse_of.blank? && Rails.env.development?
155
+ puts "WARNING! Avo uses the 'inverse_of' option to determine the inverse association and figure out if the association permit or not detaching."
156
+ # Ex: Please configure the 'inverse_of' option for the ':users' association on the 'Project' model.
157
+ puts "Please configure the 'inverse_of' option for the '#{current_reflection.macro} :#{current_reflection.name}' association on the '#{current_reflection.active_record.name}' model."
158
+ puts "Otherwise the detach button will be visible by default.\n\n"
157
159
  end
158
160
 
159
161
  inverse_of
@@ -90,7 +90,7 @@ module Avo
90
90
  path = instance_eval(&path)
91
91
  end
92
92
 
93
- redirect_to path
93
+ redirect_to path, **{allow_other_host: response[:allow_other_host], status: response[:status]}.compact
94
94
  elsif response[:type] == :reload
95
95
  redirect_back fallback_location: resources_path(resource: @resource)
96
96
  end
@@ -14,6 +14,7 @@ module Avo
14
14
  class_attribute :standalone, default: false
15
15
  class_attribute :visible
16
16
  class_attribute :may_download_file, default: false
17
+ class_attribute :turbo
17
18
 
18
19
  attr_accessor :response
19
20
  attr_accessor :model
@@ -35,9 +36,9 @@ module Avo
35
36
  def form_data_attributes
36
37
  # We can't respond with a file download from Turbo se we disable it on the form
37
38
  if may_download_file
38
- {turbo: false, remote: false, action_target: :form}
39
+ {turbo: turbo || false, remote: false, action_target: :form}
39
40
  else
40
- {turbo_frame: :_top, action_target: :form}
41
+ {turbo: turbo, turbo_frame: :_top, action_target: :form}.compact
41
42
  end
42
43
  end
43
44
 
@@ -196,8 +197,10 @@ module Avo
196
197
  self
197
198
  end
198
199
 
199
- def redirect_to(path = nil, &block)
200
+ def redirect_to(path = nil, allow_other_host: nil, status: nil, &block)
200
201
  response[:type] = :redirect
202
+ response[:allow_other_host] = allow_other_host
203
+ response[:status] = status
201
204
  response[:path] = if block.present?
202
205
  block
203
206
  else
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.37.1" unless const_defined?(:VERSION)
2
+ VERSION = "2.38.0" unless const_defined?(:VERSION)
3
3
  end
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: 2.37.1
4
+ version: 2.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-25 00:00:00.000000000 Z
12
+ date: 2023-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord