avo 0.5.0.beta9 → 0.5.0.beta14

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.

Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +46 -50
  3. data/Gemfile.lock +1 -6
  4. data/Rakefile +14 -14
  5. data/app/components/avo/common/multiple_file_viewer_component.rb +1 -1
  6. data/app/components/avo/common/single_file_viewer_component.rb +1 -1
  7. data/app/components/avo/edit/field_wrapper_component.rb +3 -3
  8. data/app/components/avo/index/field_wrapper_component.rb +1 -1
  9. data/app/components/avo/index/grid_item_component.rb +10 -9
  10. data/app/components/avo/index/resource_controls_component.rb +2 -2
  11. data/app/components/avo/panel_component.rb +7 -6
  12. data/app/components/avo/resource_component.rb +4 -3
  13. data/app/components/avo/show/field_wrapper_component.rb +3 -3
  14. data/app/components/avo/views/resource_edit_component.rb +4 -3
  15. data/app/components/avo/views/resource_index_component.rb +8 -7
  16. data/app/components/avo/views/resource_new_component.rb +4 -3
  17. data/app/components/avo/views/resource_show_component.rb +21 -21
  18. data/app/controllers/avo/actions_controller.rb +30 -29
  19. data/app/controllers/avo/application_controller.rb +113 -126
  20. data/app/controllers/avo/attachments_controller.rb +3 -3
  21. data/app/controllers/avo/base_controller.rb +81 -80
  22. data/app/controllers/avo/home_controller.rb +2 -2
  23. data/app/controllers/avo/relations_controller.rb +29 -28
  24. data/app/controllers/avo/resources_controller.rb +1 -1
  25. data/app/controllers/avo/search_controller.rb +20 -19
  26. data/app/helpers/avo/application_helper.rb +48 -42
  27. data/app/helpers/avo/resources_helper.rb +11 -11
  28. data/app/mailers/avo/application_mailer.rb +2 -2
  29. data/app/packs/entrypoints/application.js +9 -7
  30. data/app/packs/images/logo.png +0 -0
  31. data/app/packs/js/controllers/fields/code_field_controller.js +14 -14
  32. data/app/packs/js/controllers/filter_controller.js +9 -8
  33. data/app/packs/js/toastr.js +1 -0
  34. data/avo.gemspec +30 -31
  35. data/config/initializers/pagy.rb +1 -1
  36. data/config/routes.rb +12 -12
  37. data/config/spring.rb +5 -5
  38. data/config/webpack/base.js +2 -2
  39. data/config/webpacker.yml +32 -0
  40. data/db/factories.rb +3 -5
  41. data/lib/avo.rb +6 -6
  42. data/lib/avo/app.rb +18 -18
  43. data/lib/avo/base_action.rb +20 -20
  44. data/lib/avo/base_resource.rb +41 -45
  45. data/lib/avo/configuration.rb +16 -18
  46. data/lib/avo/engine.rb +18 -18
  47. data/lib/avo/fields/badge_field.rb +2 -2
  48. data/lib/avo/fields/base_field.rb +25 -26
  49. data/lib/avo/fields/belongs_to_field.rb +13 -12
  50. data/lib/avo/fields/boolean_field.rb +4 -4
  51. data/lib/avo/fields/boolean_group_field.rb +3 -3
  52. data/lib/avo/fields/code_field.rb +4 -4
  53. data/lib/avo/fields/country_field.rb +2 -2
  54. data/lib/avo/fields/currency_field.rb +3 -3
  55. data/lib/avo/fields/date_field.rb +3 -3
  56. data/lib/avo/fields/date_time_field.rb +2 -2
  57. data/lib/avo/fields/external_image_field.rb +2 -2
  58. data/lib/avo/fields/field_extensions/has_field_name.rb +2 -2
  59. data/lib/avo/fields/field_extensions/visible_in_different_views.rb +34 -33
  60. data/lib/avo/fields/file_field.rb +1 -1
  61. data/lib/avo/fields/files_field.rb +2 -2
  62. data/lib/avo/fields/gravatar_field.rb +9 -9
  63. data/lib/avo/fields/has_and_belongs_to_many_field.rb +1 -1
  64. data/lib/avo/fields/has_many_field.rb +1 -1
  65. data/lib/avo/fields/has_one_field.rb +2 -2
  66. data/lib/avo/fields/heading_field.rb +2 -2
  67. data/lib/avo/fields/hidden_field.rb +1 -1
  68. data/lib/avo/fields/id_field.rb +3 -3
  69. data/lib/avo/fields/key_value_field.rb +12 -12
  70. data/lib/avo/fields/markdown_field.rb +2 -2
  71. data/lib/avo/fields/number_field.rb +3 -3
  72. data/lib/avo/fields/password_field.rb +1 -1
  73. data/lib/avo/fields/select_field.rb +8 -12
  74. data/lib/avo/fields/status_field.rb +4 -4
  75. data/lib/avo/fields/text_field.rb +2 -2
  76. data/lib/avo/fields/textarea_field.rb +2 -2
  77. data/lib/avo/fields/trix_field.rb +1 -1
  78. data/lib/avo/fields_collector.rb +4 -5
  79. data/lib/avo/filters/base_filter.rb +6 -6
  80. data/lib/avo/filters/boolean_filter.rb +1 -1
  81. data/lib/avo/filters/select_filter.rb +1 -1
  82. data/lib/avo/licensing/h_q.rb +56 -55
  83. data/lib/avo/licensing/license.rb +5 -5
  84. data/lib/avo/licensing/license_manager.rb +4 -4
  85. data/lib/avo/licensing/null_license.rb +2 -2
  86. data/lib/avo/licensing/pro_license.rb +1 -1
  87. data/lib/avo/loaders/fields_loader.rb +4 -4
  88. data/lib/avo/services/authorization_service.rb +2 -2
  89. data/lib/avo/services/panel_service.rb +4 -4
  90. data/lib/avo/version.rb +1 -1
  91. data/lib/generators/avo/action_generator.rb +4 -4
  92. data/lib/generators/avo/controller_generator.rb +4 -4
  93. data/lib/generators/avo/filter_generator.rb +5 -5
  94. data/lib/generators/avo/install_generator.rb +8 -8
  95. data/lib/generators/avo/locales_generator.rb +5 -5
  96. data/lib/generators/avo/partials_generator.rb +4 -4
  97. data/lib/generators/avo/resource_generator.rb +5 -5
  98. data/lib/generators/avo/templates/action.tt +0 -4
  99. data/lib/generators/avo/templates/resource/resource.tt +3 -13
  100. data/lib/tasks/avo_tasks.rake +0 -60
  101. data/public/avo-packs/css/{application-38e7e91b.css → application-9d115b7e.css} +44 -147
  102. data/public/avo-packs/css/application-9d115b7e.css.br +0 -0
  103. data/public/avo-packs/css/application-9d115b7e.css.gz +0 -0
  104. data/public/avo-packs/css/application-9d115b7e.css.map +1 -0
  105. data/public/avo-packs/css/application-9d115b7e.css.map.br +0 -0
  106. data/public/avo-packs/css/application-9d115b7e.css.map.gz +0 -0
  107. data/public/avo-packs/js/{application-2b90fe889f7d6df1ad92.js → application-4751feac1bb0404b9c47.js} +4 -4
  108. data/public/avo-packs/js/{application-2b90fe889f7d6df1ad92.js.LICENSE.txt → application-4751feac1bb0404b9c47.js.LICENSE.txt} +0 -0
  109. data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.br +0 -0
  110. data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.gz +0 -0
  111. data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.map +1 -0
  112. data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.map.br +0 -0
  113. data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.map.gz +0 -0
  114. data/public/avo-packs/manifest.json +16 -16
  115. data/public/avo-packs/media/images/dadf2db36589607d107d.png +0 -0
  116. metadata +16 -31
  117. data/config/initializers/inline_svg.rb +0 -33
  118. data/public/avo-packs/css/application-38e7e91b.css.br +0 -0
  119. data/public/avo-packs/css/application-38e7e91b.css.gz +0 -0
  120. data/public/avo-packs/css/application-38e7e91b.css.map +0 -1
  121. data/public/avo-packs/css/application-38e7e91b.css.map.br +0 -0
  122. data/public/avo-packs/css/application-38e7e91b.css.map.gz +0 -0
  123. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.br +0 -0
  124. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.gz +0 -0
  125. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map +0 -1
  126. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map.br +0 -0
  127. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map.gz +0 -0
  128. data/public/avo-packs/media/images/f1b4befac91a3336db9a.png +0 -0
@@ -21,7 +21,8 @@ class Avo::Views::ResourceNewComponent < ViewComponent::Base
21
21
  end
22
22
 
23
23
  private
24
- def via_resource?
25
- params[:via_relation_class].present? and params[:via_resource_id].present?
26
- end
24
+
25
+ def via_resource?
26
+ params[:via_relation_class].present? && params[:via_resource_id].present?
27
+ end
27
28
  end
@@ -38,29 +38,29 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
38
38
  end
39
39
 
40
40
  private
41
- def via_resource?
42
- params[:via_resource_class].present? and params[:via_resource_id].present?
43
- end
44
41
 
45
- def split_panel_fields
46
- @fields_by_panel = {}
47
- @has_one_panels = []
48
- @has_many_panels = []
49
- @has_as_belongs_to_many_panels = []
42
+ def via_resource?
43
+ params[:via_resource_class].present? && params[:via_resource_id].present?
44
+ end
50
45
 
51
- @resource.get_fields.each do |field|
52
- case field.class.to_s
53
- when 'Avo::Fields::HasOneField'
54
- @has_one_panels << field
55
- when 'Avo::Fields::HasManyField'
56
- @has_many_panels << field
57
- when 'Avo::Fields::HasAndBelongsToManyField'
58
- @has_as_belongs_to_many_panels << field
59
- else
60
- @fields_by_panel[field.panel_name] ||= []
61
- @fields_by_panel[field.panel_name] << field
62
- end
63
- end
46
+ def split_panel_fields
47
+ @fields_by_panel = {}
48
+ @has_one_panels = []
49
+ @has_many_panels = []
50
+ @has_as_belongs_to_many_panels = []
64
51
 
52
+ @resource.get_fields.each do |field|
53
+ case field.class.to_s
54
+ when "Avo::Fields::HasOneField"
55
+ @has_one_panels << field
56
+ when "Avo::Fields::HasManyField"
57
+ @has_many_panels << field
58
+ when "Avo::Fields::HasAndBelongsToManyField"
59
+ @has_as_belongs_to_many_panels << field
60
+ else
61
+ @fields_by_panel[field.panel_name] ||= []
62
+ @fields_by_panel[field.panel_name] << field
63
+ end
65
64
  end
65
+ end
66
66
  end
@@ -1,4 +1,4 @@
1
- require_dependency 'avo/application_controller'
1
+ require_dependency "avo/application_controller"
2
2
 
3
3
  module Avo
4
4
  class ActionsController < ApplicationController
@@ -11,11 +11,11 @@ module Avo
11
11
  end
12
12
 
13
13
  def handle
14
- resource_ids = action_params[:fields][:resource_ids].split(',').map(&:to_i)
14
+ resource_ids = action_params[:fields][:resource_ids].split(",").map(&:to_i)
15
15
  models = @resource.model_class.find resource_ids
16
16
 
17
17
  fields = action_params[:fields].select do |key, value|
18
- key != 'resource_ids'
18
+ key != "resource_ids"
19
19
  end
20
20
 
21
21
  performed_action = @action.handle_action(models: models, fields: fields)
@@ -24,44 +24,45 @@ module Avo
24
24
  end
25
25
 
26
26
  private
27
- def action_params
28
- params.permit(:resource_name, :action_id, fields: {})
29
- end
30
27
 
31
- def set_action
32
- action_class = params[:action_id].gsub('avo_actions_', '').classify.safe_constantize
28
+ def action_params
29
+ params.permit(:resource_name, :action_id, fields: {})
30
+ end
33
31
 
34
- if params[:id].present?
35
- model = @resource.model_class.find params[:id]
36
- end
32
+ def set_action
33
+ action_class = params[:action_id].gsub("avo_actions_", "").classify.safe_constantize
37
34
 
38
- @action = action_class.new(model: model, resource: resource, user: _current_user)
35
+ if params[:id].present?
36
+ model = @resource.model_class.find params[:id]
39
37
  end
40
38
 
41
- def respond(response)
42
- response[:type] ||= :reload
43
- response[:message_type] ||= :notice
44
- response[:message] ||= I18n.t('avo.action_ran_successfully')
39
+ @action = action_class.new(model: model, resource: resource, user: _current_user)
40
+ end
45
41
 
46
- if response[:type] == :download
47
- return send_data response[:path], filename: response[:filename]
48
- end
42
+ def respond(response)
43
+ response[:type] ||= :reload
44
+ response[:message_type] ||= :notice
45
+ response[:message] ||= I18n.t("avo.action_ran_successfully")
49
46
 
50
- respond_to do |format|
51
- format.html do
52
- if response[:type] == :redirect
53
- path = response[:path]
47
+ if response[:type] == :download
48
+ return send_data response[:path], filename: response[:filename]
49
+ end
54
50
 
55
- if path.respond_to? :call
56
- path = instance_eval &path
57
- end
51
+ respond_to do |format|
52
+ format.html do
53
+ if response[:type] == :redirect
54
+ path = response[:path]
58
55
 
59
- redirect_to path, "#{response[:message_type]}": response[:message]
60
- elsif response[:type] == :reload
61
- redirect_back fallback_location: resources_path(@resource.model_class), "#{response[:message_type]}": response[:message]
56
+ if path.respond_to? :call
57
+ path = instance_eval(&path)
62
58
  end
59
+
60
+ redirect_to path, "#{response[:message_type]}": response[:message]
61
+ elsif response[:type] == :reload
62
+ redirect_back fallback_location: resources_path(@resource.model_class), "#{response[:message_type]}": response[:message]
63
63
  end
64
64
  end
65
65
  end
66
+ end
66
67
  end
67
68
  end
@@ -23,11 +23,13 @@ module Avo
23
23
  def exception_logger(exception)
24
24
  respond_to do |format|
25
25
  format.html { raise exception }
26
- format.json { render json: {
27
- errors: exception.respond_to?(:record) && exception.record.present? ? exception.record.errors : [],
28
- message: exception.message,
29
- traces: exception.backtrace,
30
- }, status: ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name) }
26
+ format.json {
27
+ render json: {
28
+ errors: exception.respond_to?(:record) && exception.record.present? ? exception.record.errors : [],
29
+ message: exception.message,
30
+ traces: exception.backtrace
31
+ }, status: ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name)
32
+ }
31
33
  end
32
34
  end
33
35
 
@@ -48,8 +50,7 @@ module Avo
48
50
  if keep_query_params
49
51
  existing_params = Addressable::URI.parse(request.fullpath).query_values.symbolize_keys
50
52
  end
51
- rescue;end
52
-
53
+ rescue; end
53
54
  send :"resources_#{model.model_name.route_key}_path", **existing_params, **args
54
55
  end
55
56
 
@@ -62,22 +63,13 @@ module Avo
62
63
  if keep_query_params
63
64
  existing_params = Addressable::URI.parse(request.fullpath).query_values.symbolize_keys
64
65
  end
65
- rescue;end
66
-
66
+ rescue; end
67
67
  Addressable::Template.new("#{Avo.configuration.root_path}/resources/#{@parent_resource.model.model_name.route_key}/#{@parent_resource.model.id}/#{@resource.route_key}{?query*}")
68
68
  .expand({query: {**existing_params, **args}})
69
69
  .to_str
70
70
  end
71
71
 
72
72
  def resource_path(model = nil, resource_id: nil, keep_query_params: false, **args)
73
- existing_params = {}
74
-
75
- begin
76
- if keep_query_params
77
- existing_params = Addressable::URI.parse(request.fullpath).query_values.symbolize_keys
78
- end
79
- rescue;end
80
-
81
73
  return send :"resources_#{model.model_name.route_key.singularize}_path", resource_id, **args if resource_id.present?
82
74
 
83
75
  send :"resources_#{model.model_name.route_key.singularize}_path", model, **args
@@ -108,151 +100,146 @@ module Avo
108
100
  end
109
101
 
110
102
  private
111
- def set_resource_name
112
- @resource_name = resource_name
113
- end
114
103
 
115
- def set_related_resource_name
116
- @related_resource_name = related_resource_name
117
- end
104
+ def set_resource_name
105
+ @resource_name = resource_name
106
+ end
118
107
 
119
- def set_resource
120
- @resource = resource.hydrate(params: params)
121
- end
108
+ def set_related_resource_name
109
+ @related_resource_name = related_resource_name
110
+ end
122
111
 
123
- def set_related_resource
124
- @related_resource = related_resource.hydrate(params: params)
125
- end
112
+ def set_resource
113
+ @resource = resource.hydrate(params: params)
114
+ end
126
115
 
127
- def set_model
128
- @model = eager_load_files(@resource, @resource.model_class).find params[:id]
129
- end
116
+ def set_related_resource
117
+ @related_resource = related_resource.hydrate(params: params)
118
+ end
130
119
 
131
- def set_related_model
132
- @related_model = eager_load_files(@related_resource, @related_resource.model_class).find params[:related_id]
133
- end
120
+ def set_model
121
+ @model = eager_load_files(@resource, @resource.model_class).find params[:id]
122
+ end
134
123
 
135
- def hydrate_resource
136
- @resource.hydrate(view: action_name.to_sym, user: _current_user)
137
- end
124
+ def set_related_model
125
+ @related_model = eager_load_files(@related_resource, @related_resource.model_class).find params[:related_id]
126
+ end
138
127
 
139
- def hydrate_related_resource
140
- @related_resource.hydrate(view: action_name.to_sym, user: _current_user)
141
- end
128
+ def hydrate_resource
129
+ @resource.hydrate(view: action_name.to_sym, user: _current_user)
130
+ end
142
131
 
143
- def authorize_action
144
- if @model.present?
145
- @authorization.set_record(@model).authorize_action :index
146
- else
147
- @authorization.set_record(@resource.model_class).authorize_action :index
148
- end
149
- end
132
+ def hydrate_related_resource
133
+ @related_resource.hydrate(view: action_name.to_sym, user: _current_user)
134
+ end
150
135
 
151
- # Get the pluralized resource name for this request
152
- # Ex: projects, teams, users
153
- def resource_name
154
- return params[:resource_name] if params[:resource_name].present?
136
+ def authorize_action
137
+ if @model.present?
138
+ @authorization.set_record(@model).authorize_action :index
139
+ else
140
+ @authorization.set_record(@resource.model_class).authorize_action :index
141
+ end
142
+ end
155
143
 
156
- return controller_name if controller_name.present?
144
+ # Get the pluralized resource name for this request
145
+ # Ex: projects, teams, users
146
+ def resource_name
147
+ return params[:resource_name] if params[:resource_name].present?
157
148
 
158
- begin
159
- request.path
160
- .match(/\/?#{Avo.configuration.root_path.gsub('/', '')}\/resources\/([a-z1-9\-_]*)\/?/mi)
161
- .captures
162
- .first
163
- rescue => exception
164
- end
165
- end
149
+ return controller_name if controller_name.present?
166
150
 
167
- def related_resource_name
168
- params[:related_name]
151
+ begin
152
+ request.path
153
+ .match(/\/?#{Avo.configuration.root_path.delete('/')}\/resources\/([a-z1-9\-_]*)\/?/mi)
154
+ .captures
155
+ .first
156
+ rescue
169
157
  end
158
+ end
170
159
 
171
- # Gets the Avo resource for this request based on the request from the `resource_name` "param"
172
- # Ex: Avo::Resources::Project, Avo::Resources::Team, Avo::Resources::User
173
- def resource
160
+ def related_resource_name
161
+ params[:related_name]
162
+ end
174
163
 
175
- resource = App.get_resource @resource_name.to_s.camelize.singularize
164
+ # Gets the Avo resource for this request based on the request from the `resource_name` "param"
165
+ # Ex: Avo::Resources::Project, Avo::Resources::Team, Avo::Resources::User
166
+ def resource
167
+ resource = App.get_resource @resource_name.to_s.camelize.singularize
176
168
 
177
- return resource if resource.present?
169
+ return resource if resource.present?
178
170
 
179
- App.get_resource_by_controller_name @resource_name
180
- end
171
+ App.get_resource_by_controller_name @resource_name
172
+ end
181
173
 
182
- def related_resource
183
- reflection = @model._reflections[params[:related_name]]
174
+ def related_resource
175
+ reflection = @model._reflections[params[:related_name]]
184
176
 
185
- if reflection.is_a? ::ActiveRecord::Reflection::HasOneReflection
186
- reflected_model = reflection.klass
187
- else
188
- reflected_model = reflection.klass
189
- end
177
+ reflected_model = reflection.klass
190
178
 
191
- App.get_resource_by_model_name reflected_model
192
- end
179
+ App.get_resource_by_model_name reflected_model
180
+ end
193
181
 
194
- def eager_load_files(resource, query)
195
- if resource.attached_file_fields.present?
196
- resource.attached_file_fields.map do |field|
197
- # abort "#{field.pluralize}".inspect
198
- # abort field.class.inspect
199
- attachment = case field.class.to_s
200
- when 'Avo::Fields::FileField'
201
- 'attachment'
202
- when 'Avo::Fields::FilesField'
203
- 'attachments'
204
- else
205
- 'attachment'
206
- end
207
-
208
- return query.eager_load "#{field.id}_#{attachment}": :blob
209
- # return query.send :"with_attached_#{field}"
182
+ def eager_load_files(resource, query)
183
+ if resource.attached_file_fields.present?
184
+ resource.attached_file_fields.map do |field|
185
+ # abort "#{field.pluralize}".inspect
186
+ # abort field.class.inspect
187
+ attachment = case field.class.to_s
188
+ when "Avo::Fields::FileField"
189
+ "attachment"
190
+ when "Avo::Fields::FilesField"
191
+ "attachments"
192
+ else
193
+ "attachment"
210
194
  end
211
- end
212
195
 
213
- query
196
+ return query.eager_load "#{field.id}_#{attachment}": :blob
197
+ # return query.send :"with_attached_#{field}"
198
+ end
214
199
  end
215
200
 
201
+ query
202
+ end
216
203
 
217
- # def authorize_user
218
- # return if params[:controller] == 'avo/search'
219
-
220
- # model = record = resource.model
204
+ # def authorize_user
205
+ # return if params[:controller] == 'avo/search'
221
206
 
222
- # if ['show', 'edit', 'update'].include?(params[:action]) && params[:controller] == 'avo/resources'
223
- # record = resource
224
- # end
207
+ # model = record = resource.model
225
208
 
226
- # # AuthorizationService::authorize_action _current_user, record, params[:action] return render_unauthorized unless
227
- # end
209
+ # if ['show', 'edit', 'update'].include?(params[:action]) && params[:controller] == 'avo/resources'
210
+ # record = resource
211
+ # end
228
212
 
229
- def _authenticate!
230
- instance_eval(&Avo.configuration.authenticate)
231
- end
213
+ # # AuthorizationService::authorize_action _current_user, record, params[:action] return render_unauthorized unless
214
+ # end
232
215
 
233
- def render_unauthorized(exception)
234
- if !exception.is_a? Pundit::NotDefinedError
235
- flash[:notice] = t 'avo.not_authorized'
216
+ def _authenticate!
217
+ instance_eval(&Avo.configuration.authenticate)
218
+ end
236
219
 
237
- redirect_url = if request.referrer.blank? or request.referrer == request.url
238
- root_url
239
- else
240
- request.referrer
241
- end
220
+ def render_unauthorized(exception)
221
+ if !exception.is_a? Pundit::NotDefinedError
222
+ flash[:notice] = t "avo.not_authorized"
242
223
 
243
- redirect_to(redirect_url)
224
+ redirect_url = if request.referrer.blank? || (request.referrer == request.url)
225
+ root_url
226
+ else
227
+ request.referrer
244
228
  end
245
- end
246
229
 
247
- def set_authorization
248
- @authorization = Services::AuthorizationService.new _current_user
230
+ redirect_to(redirect_url)
249
231
  end
232
+ end
250
233
 
251
- def set_container_classes
252
- contain = !Avo.configuration.full_width_container
253
- contain = false if Avo.configuration.full_width_index_view && action_name.to_sym == :index && self.class.superclass.to_s == 'Avo::ResourcesController'
234
+ def set_authorization
235
+ @authorization = Services::AuthorizationService.new _current_user
236
+ end
254
237
 
255
- @container_classes = contain ? '2xl:container 2xl:mx-auto' : ''
256
- end
238
+ def set_container_classes
239
+ contain = !Avo.configuration.full_width_container
240
+ contain = false if Avo.configuration.full_width_index_view && action_name.to_sym == :index && self.class.superclass.to_s == "Avo::ResourcesController"
241
+
242
+ @container_classes = contain ? "2xl:container 2xl:mx-auto" : ""
243
+ end
257
244
  end
258
245
  end