avo 1.18.2.pre.0 → 1.18.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: 88cca5eb20b3bf2b5ffec2d183425a17397af2e2348f75f77b04eba1b7273f42
4
- data.tar.gz: 95f9929e160e72e1d3b1f2916e234c5aca8831951af44b262552c29418435776
3
+ metadata.gz: 3a9e6624587295b46f8f052da4cb2b6ffb8faff958d1de9ab0fe2eb98a58c05c
4
+ data.tar.gz: 1010b48e463a388d0b20e3348de1c49f8468d63c2a14d78fe9ca4a9ad5c87e3e
5
5
  SHA512:
6
- metadata.gz: 84865027b7970efac44ab3899268123af6d081b59cd28781a26c5075c7ccff3197b6546f70bed48aa202ecdee3d7586f4356863908f42a462bf35871cd0d59ae
7
- data.tar.gz: 5dd638cd5699db08ab642cfc00523ff19f9cb8338408d9b38ba0b167ec23fab209529367be43f87ac117f2f9173fe498e5cdc37ec8533202135902a6b4a80b75
6
+ metadata.gz: d18de447e0138f28d1ceb806bf16968b88dc81c0f1b097fee892bda8b19259a8df939c3fe3060e963a0f1f04e2696f3706b1f68a42b92c2e1f53a48e09788518
7
+ data.tar.gz: 91d9ec101ce25c6dba5300a054476ef8fef432cfe18d6140b0f6ff92a73be95fca213a549af6c38bfd7e3f392822ad6feaeea2fff77f208395137f063e3b7594
data/Gemfile CHANGED
@@ -131,6 +131,6 @@ gem 'ransack'
131
131
 
132
132
  gem 'friendly_id', '~> 5.4.0'
133
133
 
134
- gem "aws-sdk-s3", require: false
134
+ gem 'aws-sdk-s3', require: false
135
135
 
136
136
  gem 'net-smtp', require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (1.18.2.pre.0)
4
+ avo (1.18.2)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -227,10 +227,8 @@ GEM
227
227
  nokogiri (1.13.0)
228
228
  mini_portile2 (~> 2.7.0)
229
229
  racc (~> 1.4)
230
- nokogiri (1.13.0-x86_64-linux)
231
- racc (~> 1.4)
232
230
  orm_adapter (0.5.0)
233
- pagy (5.7.1)
231
+ pagy (5.7.3)
234
232
  parallel (1.21.0)
235
233
  parser (3.1.0.0)
236
234
  ast (~> 2.4.1)
@@ -1,3 +1,7 @@
1
1
  <%= index_field_wrapper field: @field do %>
2
- <%= link_to_if @field.link_to_resource, @field.value, resource_path %>
2
+ <% if @field.as_html %>
3
+ <%== @field.value %>
4
+ <% else %>
5
+ <%= link_to_if @field.link_to_resource, @field.value, resource_path %>
6
+ <% end %>
3
7
  <% end %>
@@ -1,3 +1,7 @@
1
1
  <%= show_field_wrapper field: @field, index: @index do %>
2
- <%= @field.value %>
2
+ <% if @field.as_html %>
3
+ <%== @field.value %>
4
+ <% else %>
5
+ <%= @field.value %>
6
+ <% end %>
3
7
  <% end %>
@@ -1,4 +1,6 @@
1
- <div <% if main_app.respond_to?(:destroy_user_session_path) %> data-controller="toggle-panel" <% end %>>
1
+ <% destroy_user_session_path = "destroy_#{Avo.configuration.current_user_resource_name}_session_path".to_sym %>
2
+
3
+ <div <% if main_app.respond_to?(destroy_user_session_path) %> data-controller="toggle-panel" <% end %>>
2
4
  <a href="javascript:void(0);" class="flex items-center cursor-pointer font-semibold text-gray-700" data-action="click->toggle-panel#togglePanel">
3
5
  <% if _current_user.respond_to?(:avatar) && _current_user.avatar.present? %>
4
6
  <%= image_tag _current_user.avatar, class: "h-12 rounded-full border-4 border-white mr-1" %>
@@ -10,14 +12,14 @@
10
12
  <% else %>
11
13
  Avo user
12
14
  <% end %>
13
- <% if main_app.respond_to?(:destroy_user_session_path) %>
15
+ <% if main_app.respond_to?(destroy_user_session_path) %>
14
16
  <%= svg 'chevron-down', class: "ml-1 h-4" %>
15
17
  <% end %>
16
18
  </a>
17
19
 
18
- <% if main_app.respond_to?(:destroy_user_session_path) %>
19
- <div class="hidden absolute inset-auto inset-auto right-0 mr-6 mt-0 py-4 bg-white rounded-xl min-w-[200px] shadow-context" data-toggle-panel-target="panel">
20
- <%= button_to t('avo.sign_out'), main_app.destroy_user_session_path, method: :delete, form: { "data-turbo" => "false" }, class: "appearance-none bg-white text-left cursor-pointer text-green-600 font-semibold hover:text-white hover:bg-green-500 block px-4 py-1 w-full" %>
20
+ <% if main_app.respond_to?(destroy_user_session_path) %>
21
+ <div class="hidden absolute inset-auto right-0 mr-6 mt-0 py-4 bg-white rounded-xl min-w-[200px] shadow-context" data-toggle-panel-target="panel">
22
+ <%= button_to t('avo.sign_out'), main_app.send(:destroy_user_session_path), method: :delete, form: { "data-turbo" => "false" }, class: "appearance-none bg-white text-left cursor-pointer text-green-600 font-semibold hover:text-white hover:bg-green-500 block px-4 py-1 w-full" %>
21
23
  </div>
22
24
  <% end %>
23
25
  </div>
data/lib/avo/app.rb CHANGED
@@ -32,7 +32,11 @@ module Avo
32
32
 
33
33
  # Set the current host for ActiveStorage
34
34
  begin
35
- ActiveStorage::Current.url_options = request.base_url
35
+ if Rails::VERSION::MAJOR === 6
36
+ ActiveStorage::Current.host = request.base_url
37
+ elsif Rails::VERSION::MAJOR === 7
38
+ ActiveStorage::Current.url_options = request.base_url
39
+ end
36
40
  rescue => exception
37
41
  Rails.logger.debug "[Avo] Failed to set ActiveStorage::Current.url_options, #{exception.inspect}"
38
42
  end
@@ -121,8 +125,8 @@ module Avo
121
125
 
122
126
  def get_available_resources(user = nil)
123
127
  resources.select do |resource|
124
- Services::AuthorizationService.authorize user, resource.model_class, Avo.configuration.authorization_methods.stringify_keys["index"], raise_exception: false
125
- end
128
+ Services::AuthorizationService.authorize user, resource.model_class, Avo.configuration.authorization_methods.stringify_keys["index"], raise_exception: false
129
+ end
126
130
  .sort_by { |r| r.name }
127
131
  end
128
132
 
@@ -145,7 +149,7 @@ module Avo
145
149
  # remove the leading underscore (_)
146
150
  filename[0] = ""
147
151
  # remove the extension
148
- filename.gsub!('.html.erb', '')
152
+ filename.gsub!(".html.erb", "")
149
153
  filename
150
154
  end
151
155
  end
@@ -25,6 +25,7 @@ module Avo
25
25
  attr_accessor :search_debounce
26
26
  attr_accessor :view_component_path
27
27
  attr_accessor :display_license_request_timeout_error
28
+ attr_accessor :current_user_resource_name
28
29
 
29
30
  def initialize
30
31
  @root_path = "/avo"
@@ -62,6 +63,7 @@ module Avo
62
63
  @search_debounce = 300
63
64
  @view_component_path = "app/components"
64
65
  @display_license_request_timeout_error = true
66
+ @current_user_resource_name = "user"
65
67
  end
66
68
 
67
69
  def locale_tag
@@ -2,11 +2,13 @@ module Avo
2
2
  module Fields
3
3
  class TextField < BaseField
4
4
  attr_reader :link_to_resource
5
+ attr_reader :as_html
5
6
 
6
7
  def initialize(id, **args, &block)
7
8
  super(id, **args, &block)
8
9
 
9
10
  @link_to_resource = args[:link_to_resource].present? ? args[:link_to_resource] : false
11
+ @as_html = args[:as_html].present? ? args[:as_html] : false
10
12
  end
11
13
  end
12
14
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "1.18.2.pre.0"
2
+ VERSION = "1.18.2"
3
3
  end