avo 2.45.0 → 2.46.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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/components/avo/field_wrapper_component.rb +14 -3
- data/app/components/avo/fields/belongs_to_field/edit_component.rb +1 -1
- data/app/views/avo/actions/show.html.erb +2 -2
- data/lib/avo/base_action.rb +1 -0
- data/lib/avo/base_resource.rb +1 -1
- data/lib/avo/concerns/has_action_stimulus_controllers.rb +15 -0
- data/lib/avo/concerns/has_html_attributes.rb +27 -12
- data/lib/avo/concerns/{has_stimulus_controllers.rb → has_resource_stimulus_controllers.rb} +1 -1
- data/lib/avo/fields/base_field.rb +1 -0
- data/lib/avo/licensing/h_q.rb +1 -1
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/locales/avo.ar.yml +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1732dea0a1d6b5884e2119151890af9c9231130feb1ae8fcfda51ce5f6380fa2
|
4
|
+
data.tar.gz: 2ad0edd469aa3452c563ab37d65380f9ac04aac8845da08c1a8830bb3b36cf7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc5bd679ff67400b1b68ad0c09b16b1f991b0c7e2e1db02cc2e15aa8fc25873f0fdfb2304b5482531e71bf49a62d7f24be2baff6ff5247321ecc70980c763ce4
|
7
|
+
data.tar.gz: ae13f86f47ed15d14f0eb128072d4ea5c4dfc5299f9dfd2729c7eb48d561ac6c1bd24af6bc92732a0eac3c798c38dbe3e2d7e37896415dba79f74beeaf18b7c6
|
data/Gemfile.lock
CHANGED
@@ -35,6 +35,7 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
|
|
35
35
|
@full_width = full_width
|
36
36
|
@label = label
|
37
37
|
@resource = resource
|
38
|
+
@action = field.action
|
38
39
|
@stacked = stacked
|
39
40
|
@style = style
|
40
41
|
@view = view
|
@@ -83,9 +84,11 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
|
|
83
84
|
|
84
85
|
# Add the built-in stimulus integration data tags.
|
85
86
|
if @resource.present?
|
86
|
-
@resource
|
87
|
-
|
88
|
-
|
87
|
+
add_stimulus_attributes_for(@resource, attributes)
|
88
|
+
end
|
89
|
+
|
90
|
+
if @action.present?
|
91
|
+
add_stimulus_attributes_for(@action, attributes)
|
89
92
|
end
|
90
93
|
|
91
94
|
# Fetch the data attributes off the html option
|
@@ -115,4 +118,12 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
|
|
115
118
|
def full_width?
|
116
119
|
@full_width
|
117
120
|
end
|
121
|
+
|
122
|
+
private
|
123
|
+
|
124
|
+
def add_stimulus_attributes_for(entity, attributes)
|
125
|
+
entity.get_stimulus_controllers.split(" ").each do |controller|
|
126
|
+
attributes["#{controller}-target"] = "#{@field.id.to_s.underscore}_#{@field.type.to_s.underscore}_wrapper".camelize(:lower)
|
127
|
+
end
|
128
|
+
end
|
118
129
|
end
|
@@ -63,7 +63,7 @@ class Avo::Fields::BelongsToField::EditComponent < Avo::Fields::EditComponent
|
|
63
63
|
helpers.new_resource_path(**{
|
64
64
|
via_relation: @field.id.to_s,
|
65
65
|
resource: target_resource || @field.target_resource,
|
66
|
-
via_resource_id: resource.model.to_param,
|
66
|
+
via_resource_id: resource.model.persisted? ? resource.model.to_param : nil,
|
67
67
|
via_belongs_to_resource_class: resource.class.name
|
68
68
|
}.compact)
|
69
69
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= turbo_frame_tag "actions_show" do %>
|
2
2
|
<div
|
3
|
-
data-controller="action"
|
3
|
+
data-controller="<%= ["action", @action.get_stimulus_controllers].join(" ") %>"
|
4
4
|
data-no-confirmation="<%= @action.no_confirmation %>"
|
5
5
|
data-action-target="controllerDiv"
|
6
6
|
data-resource-name="<%= @resource.model_key %>"
|
@@ -27,7 +27,7 @@
|
|
27
27
|
<div class="my-4 -mx-6">
|
28
28
|
<% @action.get_fields.each_with_index do |field, index| %>
|
29
29
|
<%= render field
|
30
|
-
.hydrate(resource: @resource, model: @resource.model, user: @resource.user, view: @view)
|
30
|
+
.hydrate(resource: @resource, model: @resource.model, user: @resource.user, view: @view, action: @action)
|
31
31
|
.component_for_view(@view)
|
32
32
|
.new(field: field, resource: @resource, index: index, form: form, compact: true)
|
33
33
|
%>
|
data/lib/avo/base_action.rb
CHANGED
data/lib/avo/base_resource.rb
CHANGED
@@ -6,7 +6,7 @@ module Avo
|
|
6
6
|
include Avo::Concerns::HasFields
|
7
7
|
include Avo::Concerns::CanReplaceFields
|
8
8
|
include Avo::Concerns::HasEditableControls
|
9
|
-
include Avo::Concerns::
|
9
|
+
include Avo::Concerns::HasResourceStimulusControllers
|
10
10
|
include Avo::Concerns::ModelClassConstantized
|
11
11
|
include Avo::Concerns::Pagination
|
12
12
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Avo
|
2
|
+
module Concerns
|
3
|
+
module HasActionStimulusControllers
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
class_attribute :stimulus_controllers, default: ""
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_stimulus_controllers
|
11
|
+
self.class.stimulus_controllers
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -27,7 +27,10 @@ module Avo
|
|
27
27
|
default_attribute_value name
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
add_action_data_attributes(attributes, name, element)
|
31
|
+
add_resource_data_attributes(attributes, name, element, view)
|
32
|
+
|
33
|
+
attributes
|
31
34
|
end
|
32
35
|
|
33
36
|
private
|
@@ -47,18 +50,17 @@ module Avo
|
|
47
50
|
name == :data ? {} : ""
|
48
51
|
end
|
49
52
|
|
50
|
-
def
|
51
|
-
if
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
[:"#{controller}-target", "#{id.to_s.underscore}_#{type.to_s.underscore}_input".camelize(:lower)]
|
56
|
-
end
|
57
|
-
.to_h
|
53
|
+
def add_action_data_attributes(attributes, name, element)
|
54
|
+
if can_add_stimulus_attributes_for?(action, attributes, name, element)
|
55
|
+
attributes.merge!(stimulus_attributes_for(action))
|
56
|
+
end
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
def add_resource_data_attributes(attributes, name, element, view)
|
60
|
+
if can_add_stimulus_attributes_for?(resource, attributes, name, element) && view.in?([:edit, :new])
|
61
|
+
resource_stimulus_attributes = stimulus_attributes_for(resource)
|
62
|
+
|
63
|
+
attributes.merge!(resource_stimulus_attributes)
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
@@ -103,6 +105,19 @@ module Avo
|
|
103
105
|
|
104
106
|
result if result.present?
|
105
107
|
end
|
108
|
+
|
109
|
+
def can_add_stimulus_attributes_for?(entity, attributes, name, element)
|
110
|
+
!attributes.nil? && name == :data && element == :input && entity.present? && entity.respond_to?(:get_stimulus_controllers)
|
111
|
+
end
|
112
|
+
|
113
|
+
def stimulus_attributes_for(entity)
|
114
|
+
entity.get_stimulus_controllers
|
115
|
+
.split(" ")
|
116
|
+
.map do |controller|
|
117
|
+
[:"#{controller}-target", "#{id.to_s.underscore}_#{type.to_s.underscore}_input".camelize(:lower)]
|
118
|
+
end
|
119
|
+
.to_h
|
120
|
+
end
|
106
121
|
end
|
107
122
|
end
|
108
123
|
end
|
data/lib/avo/licensing/h_q.rb
CHANGED
@@ -6,7 +6,7 @@ module Avo
|
|
6
6
|
|
7
7
|
ENDPOINT = "https://avohq.io/api/v1/licenses/check".freeze unless const_defined?(:ENDPOINT)
|
8
8
|
REQUEST_TIMEOUT = 5 unless const_defined?(:REQUEST_TIMEOUT) # seconds
|
9
|
-
CACHE_TIME = 3600 unless const_defined?(:CACHE_TIME) # seconds
|
9
|
+
CACHE_TIME = 3600*12 unless const_defined?(:CACHE_TIME) # seconds
|
10
10
|
|
11
11
|
class << self
|
12
12
|
def cache_key
|
data/lib/avo/version.rb
CHANGED
@@ -5,7 +5,7 @@ ar:
|
|
5
5
|
actions: أوامر
|
6
6
|
and_x_other_resources: و %{count} موارد أخرى
|
7
7
|
are_you_sure: هل أنت متأكد؟
|
8
|
-
are_you_sure_detach_item: هل أنت متأكد أنك تريد فصل هذا
|
8
|
+
are_you_sure_detach_item: هل أنت متأكد أنك تريد فصل هذا الـ%{item}؟
|
9
9
|
are_you_sure_you_want_to_run_this_option: هل أنت متأكد أنك تريد تشغيل هذا الخيار؟
|
10
10
|
attach: ربط
|
11
11
|
attach_and_attach_another: ربط وربط آخر
|
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.
|
4
|
+
version: 2.46.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-
|
12
|
+
date: 2023-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -1747,10 +1747,11 @@ files:
|
|
1747
1747
|
- lib/avo/concerns/fetches_things.rb
|
1748
1748
|
- lib/avo/concerns/filters_session_handler.rb
|
1749
1749
|
- lib/avo/concerns/handles_field_args.rb
|
1750
|
+
- lib/avo/concerns/has_action_stimulus_controllers.rb
|
1750
1751
|
- lib/avo/concerns/has_editable_controls.rb
|
1751
1752
|
- lib/avo/concerns/has_fields.rb
|
1752
1753
|
- lib/avo/concerns/has_html_attributes.rb
|
1753
|
-
- lib/avo/concerns/
|
1754
|
+
- lib/avo/concerns/has_resource_stimulus_controllers.rb
|
1754
1755
|
- lib/avo/concerns/is_resource_item.rb
|
1755
1756
|
- lib/avo/concerns/model_class_constantized.rb
|
1756
1757
|
- lib/avo/concerns/pagination.rb
|