avo 3.5.8 → 3.6.0
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/app/assets/builds/avo.base.css +0 -4
- data/app/components/avo/fields/has_one_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/has_one_field/show_component.rb +1 -1
- data/app/controllers/avo/actions_controller.rb +2 -0
- data/app/controllers/avo/application_controller.rb +11 -1
- data/app/controllers/avo/associations_controller.rb +3 -1
- data/app/controllers/avo/base_controller.rb +1 -1
- data/app/helpers/avo/url_helpers.rb +1 -1
- data/app/views/avo/associations/new.html.erb +1 -1
- data/app/views/avo/partials/_alerts.html.erb +9 -0
- data/app/views/avo/partials/_attach_modal.html.erb +1 -0
- data/app/views/layouts/avo/application.html.erb +3 -11
- data/app/views/layouts/avo/blank.html.erb +1 -0
- data/lib/avo/fields/has_one_field.rb +1 -1
- data/lib/avo/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b24b80baf28fe7848e431079b17b9384ad5f4369e65a4c81bce9f1af68776d1f
|
4
|
+
data.tar.gz: '08b79a4f7fe3c462937099421fc4d90c5b02ce54a6903eaa5cf5b525e56d9f8e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71eaebcef5037f4ad99a49c8da1231c40e9aee6279cffc7083ba9f4f16ef344ccfeac970bbbe5358dc576703cb1196180338c18b0b788c1c50ab5c22f09ddc8a
|
7
|
+
data.tar.gz: c5b562841cc86aa1063e393b59a5145018808dbdb524e8e5e5c0e38b99a32893f9349b2cd286c2cded8c237379b6f065bc1b42d669bc01799d58d7aeaeeeb4b3
|
data/Gemfile.lock
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if @field.value %>
|
2
|
-
<turbo-frame id="<%= @field.turbo_frame %>" src="<%= @field.frame_url %>"
|
2
|
+
<turbo-frame id="<%= @field.turbo_frame %>" src="<%= @field.frame_url %>" loading=<%= turbo_frame_loading %> target="_top" class="block">
|
3
3
|
<%= render(Avo::LoadingComponent.new(title: @field.name)) %>
|
4
4
|
</turbo-frame>
|
5
5
|
<% else %>
|
@@ -10,7 +10,7 @@ class Avo::Fields::HasOneField::ShowComponent < Avo::Fields::ShowComponent
|
|
10
10
|
if @field.present?
|
11
11
|
reflection_resource = @field.target_resource
|
12
12
|
if reflection_resource.present? && @resource.present?
|
13
|
-
method_name = "attach_#{@field.id}?"
|
13
|
+
method_name = :"attach_#{@field.id}?"
|
14
14
|
|
15
15
|
if @resource.authorization.has_method?(method_name, raise_exception: false)
|
16
16
|
policy_result = @resource.authorization.authorize_action(method_name, raise_exception: false)
|
@@ -12,6 +12,8 @@ module Avo
|
|
12
12
|
before_action :set_action, only: [:show, :handle]
|
13
13
|
before_action :verify_authorization, only: [:show, :handle]
|
14
14
|
|
15
|
+
layout "avo/blank"
|
16
|
+
|
15
17
|
def show
|
16
18
|
# Se the view to :new so the default value gets prefilled
|
17
19
|
@view = Avo::ViewInquirer.new("new")
|
@@ -51,6 +51,10 @@ module Avo
|
|
51
51
|
super
|
52
52
|
end
|
53
53
|
|
54
|
+
def hello
|
55
|
+
puts "Nobody tested me :("
|
56
|
+
end
|
57
|
+
|
54
58
|
private
|
55
59
|
|
56
60
|
# Get the pluralized resource name for this request
|
@@ -142,7 +146,13 @@ module Avo
|
|
142
146
|
end
|
143
147
|
|
144
148
|
def set_record
|
145
|
-
|
149
|
+
id = if @resource.model_class.primary_key.is_a?(Array) && params.respond_to?(:extract_value)
|
150
|
+
params.extract_value(:id)
|
151
|
+
else
|
152
|
+
params[:id]
|
153
|
+
end
|
154
|
+
|
155
|
+
@record = @resource.find_record(id, query: model_scope, params:)
|
146
156
|
@resource.hydrate(record: @record)
|
147
157
|
end
|
148
158
|
|
@@ -16,6 +16,8 @@ module Avo
|
|
16
16
|
before_action :authorize_attach_action, only: :new
|
17
17
|
before_action :authorize_detach_action, only: :destroy
|
18
18
|
|
19
|
+
layout "avo/blank"
|
20
|
+
|
19
21
|
def index
|
20
22
|
@parent_resource = @resource.dup
|
21
23
|
@resource = @related_resource
|
@@ -63,7 +65,7 @@ module Avo
|
|
63
65
|
if reflection_class == "HasManyReflection"
|
64
66
|
@record.send(association_name) << @attachment_record
|
65
67
|
else
|
66
|
-
@record.send("#{association_name}=", @attachment_record)
|
68
|
+
@record.send(:"#{association_name}=", @attachment_record)
|
67
69
|
end
|
68
70
|
|
69
71
|
respond_to do |format|
|
@@ -516,7 +516,7 @@ module Avo
|
|
516
516
|
redirect_path_from_resource_option(:after_update_path) || resource_view_response_path
|
517
517
|
end
|
518
518
|
|
519
|
-
#
|
519
|
+
# Requires a different/special name, otherwise, in some places, this can be called instead helpers.resource_view_path
|
520
520
|
def resource_view_response_path
|
521
521
|
helpers.resource_view_path(record: @record, resource: @resource)
|
522
522
|
end
|
@@ -81,7 +81,7 @@ module Avo
|
|
81
81
|
rescue
|
82
82
|
end
|
83
83
|
|
84
|
-
avo.resources_associations_index_path(parent_record.model_name.route_key, record.
|
84
|
+
avo.resources_associations_index_path(parent_record.model_name.route_key, record.to_param, **existing_params, **args)
|
85
85
|
end
|
86
86
|
|
87
87
|
def resource_view_path(**args)
|
@@ -41,7 +41,7 @@
|
|
41
41
|
</div>
|
42
42
|
|
43
43
|
<% c.with_controls do %>
|
44
|
-
<%= a_button 'data-action': 'click->modal#close', size: :sm, style: :outline, color: :gray do %>
|
44
|
+
<%= a_button 'data-action': 'click->modal#close', type: :button, size: :sm, style: :outline, color: :gray do %>
|
45
45
|
<%= t('avo.cancel') %>
|
46
46
|
<% end %>
|
47
47
|
<%= a_button type: :submit, style: :primary, color: :green, size: :sm do %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= turbo_frame_tag :alerts, class: "fixed inset-0 bottom-0 flex flex-col space-y-4 items-end justify-right px-4 py-6 sm:p-6 justify-end z-[100] pointer-events-none" do %>
|
2
|
+
<%= render Avo::FlashAlertsComponent.new flashes: flash %>
|
3
|
+
<% # In case we have other general error messages %>
|
4
|
+
<% if @errors.present? %>
|
5
|
+
<% @errors.each do |message| %>
|
6
|
+
<%= render Avo::AlertComponent.new :error, message %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= turbo_frame_tag 'attach_modal' %>
|
@@ -51,17 +51,9 @@
|
|
51
51
|
</div>
|
52
52
|
</div>
|
53
53
|
<%= turbo_frame_tag Avo::ACTIONS_TURBO_FRAME_ID, data: {turbo_temporary: 1} %>
|
54
|
-
<%=
|
55
|
-
<%=
|
56
|
-
|
57
|
-
<% # In case we have other general error messages %>
|
58
|
-
<% if @errors.present? %>
|
59
|
-
<% @errors.each do |message| %>
|
60
|
-
<%= render Avo::AlertComponent.new :error, message %>
|
61
|
-
<% end %>
|
62
|
-
<% end %>
|
63
|
-
<% end %>
|
64
|
-
<%= render partial: "avo/partials/scripts" %>
|
54
|
+
<%= render partial: 'avo/partials/attach_modal' %>
|
55
|
+
<%= render partial: 'avo/partials/alerts' %>
|
56
|
+
<%= render partial: 'avo/partials/scripts' %>
|
65
57
|
<!-- Avo version: <%= Avo::VERSION %> -->
|
66
58
|
<!-- Environment: <%= Rails.env %> -->
|
67
59
|
<!-- License ID: <%= Avo.license.id %> -->
|
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.
|
4
|
+
version: 3.6.0
|
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-04-
|
13
|
+
date: 2024-04-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -2126,6 +2126,8 @@ files:
|
|
2126
2126
|
- app/views/avo/home/_resources.html.erb
|
2127
2127
|
- app/views/avo/home/failed_to_load.html.erb
|
2128
2128
|
- app/views/avo/home/index.html.erb
|
2129
|
+
- app/views/avo/partials/_alerts.html.erb
|
2130
|
+
- app/views/avo/partials/_attach_modal.html.erb
|
2129
2131
|
- app/views/avo/partials/_branding.html.erb
|
2130
2132
|
- app/views/avo/partials/_custom_tools_alert.html.erb
|
2131
2133
|
- app/views/avo/partials/_footer.html.erb
|