avo 2.13.5.pre.1 → 2.13.6.pre.2
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/common/single_file_viewer_component.html.erb +2 -1
- data/app/components/avo/resource_component.rb +2 -2
- data/app/components/avo/views/resource_edit_component.rb +0 -1
- data/app/javascript/js/controllers/fields/date_field_controller.js +5 -1
- data/lib/avo/base_resource.rb +1 -5
- data/lib/avo/concerns/fetches_things.rb +2 -13
- data/lib/avo/configuration.rb +0 -2
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/initializer/avo.tt +8 -10
- data/public/avo-assets/avo.js +50 -50
- data/public/avo-assets/avo.js.map +2 -2
- metadata +2 -3
- data/app/controllers/avo/team_users_controller.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df7e0432320ebd04724b2f38afaf35d5bfe652aa0c68e70b17efcf648b4d98bd
|
4
|
+
data.tar.gz: 0bc309a2c8f0e756304504dea4ababec52defc34fc9bb24aed6547c1f09af6dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1537d80c8714711ad1d181f27153c60762ec9a685703c28870c914b4e57af5c6c300da433247bc459e4f42555866fdb83f4bff74e226cd320f8175c6b3d3831
|
7
|
+
data.tar.gz: 6112b7a2b1e673938bcd7a0f048d0083eabe57b092710c40ddf20193e1efb3103d5fbcc9aa8ecdc29476fb805310a50ea5c806e3a25a0e8aff1a578b4921a64f
|
data/Gemfile.lock
CHANGED
@@ -21,7 +21,8 @@
|
|
21
21
|
<div class="flex space-x-2">
|
22
22
|
<div class="flex">
|
23
23
|
<% if @resource.authorization.authorize_action(:download_attachments?, raise_exception: false) %>
|
24
|
-
<%=
|
24
|
+
<!-- <%= file.inspect %> -->
|
25
|
+
<%= a_link file.service_url(disposition: :attachment),
|
25
26
|
icon: 'heroicons/outline/download',
|
26
27
|
color: :primary,
|
27
28
|
download: true,
|
@@ -19,7 +19,7 @@ class Avo::ResourceComponent < Avo::BaseComponent
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def can_detach?
|
22
|
-
authorize_association_for(
|
22
|
+
authorize_association_for("detach")
|
23
23
|
end
|
24
24
|
|
25
25
|
def detach_path
|
@@ -53,7 +53,7 @@ class Avo::ResourceComponent < Avo::BaseComponent
|
|
53
53
|
|
54
54
|
if @reflection.present?
|
55
55
|
# Fetch the appropiate resource
|
56
|
-
reflection_resource =
|
56
|
+
reflection_resource = ::Avo::App.get_resource_by_model_name(@reflection.active_record.name)
|
57
57
|
# Fetch the model
|
58
58
|
# Hydrate the resource with the model if we have one
|
59
59
|
reflection_resource.hydrate(model: @parent_model) if @parent_model.present?
|
@@ -117,7 +117,11 @@ export default class extends Controller {
|
|
117
117
|
|
118
118
|
flatpickr(this.fakeInputTarget, options)
|
119
119
|
|
120
|
-
|
120
|
+
if (this.enableTimeValue) {
|
121
|
+
this.updateRealInput(this.parsedValue.setZone(this.displayTimezone).toISO())
|
122
|
+
} else {
|
123
|
+
this.updateRealInput(universalTimestamp(this.initialValue))
|
124
|
+
}
|
121
125
|
}
|
122
126
|
|
123
127
|
onChange(selectedDates) {
|
data/lib/avo/base_resource.rb
CHANGED
@@ -20,6 +20,7 @@ module Avo
|
|
20
20
|
delegate :context, to: ::Avo::App
|
21
21
|
|
22
22
|
attr_accessor :view
|
23
|
+
attr_accessor :model
|
23
24
|
attr_accessor :reflection
|
24
25
|
attr_accessor :user
|
25
26
|
attr_accessor :params
|
@@ -110,11 +111,6 @@ module Avo
|
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
113
|
-
def record
|
114
|
-
@model
|
115
|
-
end
|
116
|
-
alias :model :record
|
117
|
-
|
118
114
|
def hydrate(model: nil, view: nil, user: nil, params: nil)
|
119
115
|
@view = view if view.present?
|
120
116
|
@user = user if user.present?
|
@@ -51,15 +51,10 @@ module Avo
|
|
51
51
|
#
|
52
52
|
# get_resource_by_name('User') => UserResource
|
53
53
|
# get_resource_by_name(User) => UserResource
|
54
|
-
def get_resource_by_model_name(
|
55
|
-
# Fetch the mappings imposed by the user.
|
56
|
-
# If they are present, use those ones.
|
57
|
-
mapping = get_mapping_for_model klass
|
58
|
-
return get_resource(mapping) if mapping.present?
|
59
|
-
|
54
|
+
def get_resource_by_model_name(name)
|
60
55
|
valid_resources
|
61
56
|
.find do |resource|
|
62
|
-
resource.model_class.model_name.name ==
|
57
|
+
resource.model_class.model_name.name == name.to_s
|
63
58
|
end
|
64
59
|
end
|
65
60
|
|
@@ -133,12 +128,6 @@ module Avo
|
|
133
128
|
|
134
129
|
get_sidebar_partials
|
135
130
|
end
|
136
|
-
|
137
|
-
private
|
138
|
-
|
139
|
-
def get_mapping_for_model(klass)
|
140
|
-
(Avo.configuration.model_resource_mapping || {}).stringify_keys.transform_values(&:to_s)[klass.to_s]
|
141
|
-
end
|
142
131
|
end
|
143
132
|
end
|
144
133
|
end
|
data/lib/avo/configuration.rb
CHANGED
@@ -34,7 +34,6 @@ module Avo
|
|
34
34
|
attr_accessor :buttons_on_form_footers
|
35
35
|
attr_accessor :main_menu
|
36
36
|
attr_accessor :profile_menu
|
37
|
-
attr_accessor :model_resource_mapping
|
38
37
|
|
39
38
|
def initialize
|
40
39
|
@root_path = "/avo"
|
@@ -79,7 +78,6 @@ module Avo
|
|
79
78
|
@buttons_on_form_footers = false
|
80
79
|
@main_menu = nil
|
81
80
|
@profile_menu = nil
|
82
|
-
@model_resource_mapping = {}
|
83
81
|
end
|
84
82
|
|
85
83
|
def current_user_method(&block)
|
data/lib/avo/version.rb
CHANGED
@@ -34,27 +34,25 @@ Avo.configure do |config|
|
|
34
34
|
## == Localization ==
|
35
35
|
# config.locale = 'en-US'
|
36
36
|
|
37
|
-
## == Resource options ==
|
38
|
-
# config.resource_controls = :right
|
39
|
-
# config.model_resource_mapping = {}
|
40
|
-
# config.default_view_type = :table
|
41
|
-
# config.per_page = 24
|
42
|
-
# config.per_page_steps = [12, 24, 48, 72]
|
43
|
-
# config.via_per_page = 8
|
44
|
-
# config.id_links_to_resource = false
|
45
|
-
# config.cache_resources_on_index_view = true
|
46
|
-
|
47
37
|
## == Customization ==
|
48
38
|
# config.app_name = 'Avocadelicious'
|
49
39
|
# config.timezone = 'UTC'
|
50
40
|
# config.currency = 'USD'
|
41
|
+
# config.per_page = 24
|
42
|
+
# config.per_page_steps = [12, 24, 48, 72]
|
43
|
+
# config.via_per_page = 8
|
44
|
+
# config.default_view_type = :table
|
51
45
|
# config.hide_layout_when_printing = false
|
46
|
+
# config.id_links_to_resource = false
|
52
47
|
# config.full_width_container = false
|
53
48
|
# config.full_width_index_view = false
|
49
|
+
# config.cache_resources_on_index_view = true
|
54
50
|
# config.search_debounce = 300
|
55
51
|
# config.view_component_path = "app/components"
|
56
52
|
# config.display_license_request_timeout_error = true
|
57
53
|
# config.disabled_features = []
|
54
|
+
# config.resource_controls = :right
|
55
|
+
|
58
56
|
|
59
57
|
## == Breadcrumbs ==
|
60
58
|
# config.display_breadcrumbs = true
|