avo 2.42.1 → 2.43.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/fields/belongs_to_field/edit_component.html.erb +118 -96
- data/app/components/avo/fields/belongs_to_field/edit_component.rb +11 -0
- data/app/components/avo/fields/tags_field/edit_component.html.erb +1 -0
- data/app/components/avo/modal_component.html.erb +17 -10
- data/app/components/avo/modal_component.rb +21 -0
- data/app/components/avo/panel_component.html.erb +2 -2
- data/app/components/avo/referrer_params_component.html.erb +1 -0
- data/app/components/avo/views/resource_edit_component.html.erb +11 -6
- data/app/components/avo/views/resource_edit_component.rb +11 -1
- data/app/controllers/avo/actions_controller.rb +1 -1
- data/app/controllers/avo/base_controller.rb +11 -2
- data/app/helpers/avo/application_helper.rb +4 -0
- data/app/javascript/js/controllers/fields/reload_belongs_to_field_controller.js +51 -0
- data/app/javascript/js/controllers/fields/tags_field_controller.js +2 -1
- data/app/javascript/js/controllers.js +2 -0
- data/app/views/avo/actions/show.html.erb +2 -0
- data/app/views/avo/base/_new_via_belongs_to.html.erb +12 -0
- data/app/views/avo/base/close_modal_and_reload_field.turbo_stream.erb +8 -0
- data/app/views/avo/base/create_fail_action.turbo_stream.erb +13 -0
- data/app/views/avo/partials/_flash_alerts.turbo_stream.erb +3 -0
- data/lib/avo/app.rb +1 -20
- data/lib/avo/configuration.rb +29 -0
- data/lib/avo/execution_context.rb +3 -3
- data/lib/avo/fields/tags_field.rb +2 -0
- data/lib/avo/licensing/h_q.rb +4 -2
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/initializer/avo.tt +7 -0
- data/public/avo-assets/avo.base.css +20 -8
- data/public/avo-assets/avo.base.js +84 -84
- data/public/avo-assets/avo.base.js.map +3 -3
- metadata +7 -3
- data/app/views/avo/actions/keep_modal_open.turbo_stream.erb +0 -5
data/lib/avo/app.rb
CHANGED
@@ -31,26 +31,7 @@ module Avo
|
|
31
31
|
def boot
|
32
32
|
init_fields
|
33
33
|
|
34
|
-
self.cache_store =
|
35
|
-
end
|
36
|
-
|
37
|
-
# When not in production we'll just use the MemoryStore which is good enough.
|
38
|
-
# When running in production we'll try to use memcached or redis if available.
|
39
|
-
# If not, we'll use the FileStore.
|
40
|
-
# We decided against the MemoryStore in production because it will not be shared between multiple processes (when using Puma).
|
41
|
-
def get_cache_store
|
42
|
-
if Rails.env.production?
|
43
|
-
case Rails.cache.class.to_s
|
44
|
-
when "ActiveSupport::Cache::MemCacheStore", "ActiveSupport::Cache::RedisCacheStore", "SolidCache::Store"
|
45
|
-
Rails.cache
|
46
|
-
else
|
47
|
-
ActiveSupport::Cache.lookup_store(:file_store, Rails.root.join("tmp", "cache"))
|
48
|
-
end
|
49
|
-
elsif Rails.env.test?
|
50
|
-
Rails.cache
|
51
|
-
else
|
52
|
-
ActiveSupport::Cache.lookup_store(:memory_store)
|
53
|
-
end
|
34
|
+
self.cache_store = Avo.configuration.cache_store
|
54
35
|
end
|
55
36
|
|
56
37
|
# Generate a dynamic root path using the URIService
|
data/lib/avo/configuration.rb
CHANGED
@@ -5,6 +5,7 @@ module Avo
|
|
5
5
|
attr_writer :app_name
|
6
6
|
attr_writer :branding
|
7
7
|
attr_writer :root_path
|
8
|
+
attr_writer :cache_store
|
8
9
|
attr_accessor :timezone
|
9
10
|
attr_accessor :per_page
|
10
11
|
attr_accessor :per_page_steps
|
@@ -96,6 +97,7 @@ module Avo
|
|
96
97
|
@field_wrapper_layout = :inline
|
97
98
|
@resources = nil
|
98
99
|
@prefix_path = nil
|
100
|
+
@cache_store = computed_cache_store
|
99
101
|
end
|
100
102
|
|
101
103
|
def current_user_method(&block)
|
@@ -147,6 +149,33 @@ module Avo
|
|
147
149
|
@app_name
|
148
150
|
end
|
149
151
|
end
|
152
|
+
|
153
|
+
def cache_store
|
154
|
+
Avo::ExecutionContext.new(
|
155
|
+
target: @cache_store,
|
156
|
+
production_rejected_cache_stores: %w[ActiveSupport::Cache::MemoryStore ActiveSupport::Cache::NullStore]
|
157
|
+
).handle
|
158
|
+
end
|
159
|
+
|
160
|
+
# When not in production or test we'll just use the MemoryStore which is good enough.
|
161
|
+
# When running in production we'll use Rails.cache if it's not ActiveSupport::Cache::MemoryStore or ActiveSupport::Cache::NullStore.
|
162
|
+
# If it's one of rejected cache stores, we'll use the FileStore.
|
163
|
+
# We decided against the MemoryStore in production because it will not be shared between multiple processes (when using Puma).
|
164
|
+
def computed_cache_store
|
165
|
+
-> {
|
166
|
+
if Rails.env.production?
|
167
|
+
if Rails.cache.class.to_s.in?(production_rejected_cache_stores)
|
168
|
+
ActiveSupport::Cache.lookup_store(:file_store, Rails.root.join("tmp", "cache"))
|
169
|
+
else
|
170
|
+
Rails.cache
|
171
|
+
end
|
172
|
+
elsif Rails.env.test?
|
173
|
+
Rails.cache
|
174
|
+
else
|
175
|
+
ActiveSupport::Cache.lookup_store(:memory_store)
|
176
|
+
end
|
177
|
+
}
|
178
|
+
end
|
150
179
|
end
|
151
180
|
|
152
181
|
def self.configuration
|
@@ -30,9 +30,9 @@ module Avo
|
|
30
30
|
@params ||= Avo::App.params
|
31
31
|
@view_context ||= Avo::App.view_context
|
32
32
|
@current_user ||= Avo::App.current_user
|
33
|
-
@request ||= view_context
|
34
|
-
@main_app ||= view_context
|
35
|
-
@avo ||= view_context
|
33
|
+
@request ||= view_context&.request
|
34
|
+
@main_app ||= view_context&.main_app
|
35
|
+
@avo ||= view_context&.avo
|
36
36
|
end
|
37
37
|
|
38
38
|
# Return target if target is not callable, otherwise, execute target on this instance context
|
@@ -5,6 +5,7 @@ module Avo
|
|
5
5
|
attr_reader :close_on_select
|
6
6
|
attr_reader :delimiters
|
7
7
|
attr_reader :enforce_suggestions
|
8
|
+
attr_reader :suggestions_max_items
|
8
9
|
attr_reader :mode
|
9
10
|
|
10
11
|
def initialize(id, **args, &block)
|
@@ -16,6 +17,7 @@ module Avo
|
|
16
17
|
add_array_prop args, :disallowed
|
17
18
|
add_array_prop args, :delimiters, [","]
|
18
19
|
add_array_prop args, :suggestions
|
20
|
+
add_string_prop args, :suggestions_max_items
|
19
21
|
add_string_prop args, :mode, nil
|
20
22
|
add_string_prop args, :fetch_values_from
|
21
23
|
add_string_prop args, :fetch_labels
|
data/lib/avo/licensing/h_q.rb
CHANGED
data/lib/avo/version.rb
CHANGED
@@ -47,6 +47,13 @@ Avo.configure do |config|
|
|
47
47
|
# config.per_page_steps = [12, 24, 48, 72]
|
48
48
|
# config.via_per_page = 8
|
49
49
|
# config.id_links_to_resource = false
|
50
|
+
|
51
|
+
## == Cache options ==
|
52
|
+
## Provide a lambda to customize the cache store used by Avo.
|
53
|
+
## We compute the cache store by default, this is NOT the default, just an example.
|
54
|
+
# config.cache_store = -> {
|
55
|
+
# ActiveSupport::Cache.lookup_store(:solid_cache_store)
|
56
|
+
# }
|
50
57
|
# config.cache_resources_on_index_view = true
|
51
58
|
## permanent enable or disable cache_resource_filters, default value is false
|
52
59
|
# config.cache_resource_filters = false
|
@@ -6856,6 +6856,10 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
6856
6856
|
max-height:100%
|
6857
6857
|
}
|
6858
6858
|
|
6859
|
+
.max-h-11\/12{
|
6860
|
+
max-height:91.666667%
|
6861
|
+
}
|
6862
|
+
|
6859
6863
|
.min-h-24{
|
6860
6864
|
min-height:6rem
|
6861
6865
|
}
|
@@ -7646,6 +7650,10 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
7646
7650
|
background-color:rgb(246 246 247 / var(--tw-bg-opacity))
|
7647
7651
|
}
|
7648
7652
|
|
7653
|
+
.bg-application{
|
7654
|
+
background-color:rgb(var(--color-application-background))
|
7655
|
+
}
|
7656
|
+
|
7649
7657
|
.bg-orange-700{
|
7650
7658
|
--tw-bg-opacity:1;
|
7651
7659
|
background-color:rgb(194 65 12 / var(--tw-bg-opacity))
|
@@ -7661,10 +7669,6 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
7661
7669
|
background-color:rgb(21 128 61 / var(--tw-bg-opacity))
|
7662
7670
|
}
|
7663
7671
|
|
7664
|
-
.bg-application{
|
7665
|
-
background-color:rgb(var(--color-application-background))
|
7666
|
-
}
|
7667
|
-
|
7668
7672
|
.bg-red-400{
|
7669
7673
|
--tw-bg-opacity:1;
|
7670
7674
|
background-color:rgb(248 113 113 / var(--tw-bg-opacity))
|
@@ -7853,6 +7857,14 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
7853
7857
|
padding-bottom:2rem
|
7854
7858
|
}
|
7855
7859
|
|
7860
|
+
.pt-4{
|
7861
|
+
padding-top:1rem
|
7862
|
+
}
|
7863
|
+
|
7864
|
+
.pb-8{
|
7865
|
+
padding-bottom:2rem
|
7866
|
+
}
|
7867
|
+
|
7856
7868
|
.pb-6{
|
7857
7869
|
padding-bottom:1.5rem
|
7858
7870
|
}
|
@@ -7881,10 +7893,6 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
7881
7893
|
padding-top:0px
|
7882
7894
|
}
|
7883
7895
|
|
7884
|
-
.pt-4{
|
7885
|
-
padding-top:1rem
|
7886
|
-
}
|
7887
|
-
|
7888
7896
|
.pb-4{
|
7889
7897
|
padding-bottom:1rem
|
7890
7898
|
}
|
@@ -9786,6 +9794,10 @@ trix-editor {
|
|
9786
9794
|
width:50%
|
9787
9795
|
}
|
9788
9796
|
|
9797
|
+
.lg\:w-3\/4{
|
9798
|
+
width:75%
|
9799
|
+
}
|
9800
|
+
|
9789
9801
|
.lg\:grid-cols-3{
|
9790
9802
|
grid-template-columns:repeat(3, minmax(0, 1fr))
|
9791
9803
|
}
|