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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d13118394ed2fd514b0236aafbe55beff06d3cd6f54888df9e231524c603fd4f
4
- data.tar.gz: a41d61fb7241a466663385cad7c912eaf9a57f872dd116f5bedfac6c64b5b935
3
+ metadata.gz: df7e0432320ebd04724b2f38afaf35d5bfe652aa0c68e70b17efcf648b4d98bd
4
+ data.tar.gz: 0bc309a2c8f0e756304504dea4ababec52defc34fc9bb24aed6547c1f09af6dd
5
5
  SHA512:
6
- metadata.gz: f17278e4f58a79fea9c0fe1404167813c424b03a686e4463d477f775b11d44ecd971d53b12b4c981a7e9ba466b38e85d511947b4217b2879907e1822d94be6a1
7
- data.tar.gz: a3f51221de5fff7a000591e6a643c49b4e84deb27f3b23848dc514e07697781b7c795a26c8261d2c9884be2c3de2cb65b9c841fb2e5cfb384ea24b2d459393fd
6
+ metadata.gz: c1537d80c8714711ad1d181f27153c60762ec9a685703c28870c914b4e57af5c6c300da433247bc459e4f42555866fdb83f4bff74e226cd320f8175c6b3d3831
7
+ data.tar.gz: 6112b7a2b1e673938bcd7a0f048d0083eabe57b092710c40ddf20193e1efb3103d5fbcc9aa8ecdc29476fb805310a50ea5c806e3a25a0e8aff1a578b4921a64f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.13.5.pre.1)
4
+ avo (2.13.6.pre.2)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -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
- <%= a_link helpers.main_app.url_for(file),
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(:detach)
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 = field.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?
@@ -4,7 +4,6 @@ class Avo::Views::ResourceEditComponent < Avo::ResourceComponent
4
4
  include Avo::ResourcesHelper
5
5
  include Avo::ApplicationHelper
6
6
 
7
- attr_reader :resource
8
7
  attr_reader :view
9
8
 
10
9
  def initialize(resource: nil, model: nil, actions: [], view: :edit)
@@ -117,7 +117,11 @@ export default class extends Controller {
117
117
 
118
118
  flatpickr(this.fakeInputTarget, options)
119
119
 
120
- this.updateRealInput(this.parsedValue.setZone(this.displayTimezone).toISO())
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) {
@@ -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(klass)
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 == klass.to_s
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.13.5.pre.1" unless const_defined?(:VERSION)
2
+ VERSION = "2.13.6.pre.2" unless const_defined?(:VERSION)
3
3
  end
@@ -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