avo 3.5.1 → 3.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/components/avo/index/grid_item_component.html.erb +1 -1
- data/app/components/avo/index/grid_item_component.rb +0 -1
- data/app/components/avo/index/resource_controls_component.html.erb +0 -5
- data/app/components/avo/index/resource_controls_component.rb +1 -2
- data/app/components/avo/index/resource_grid_component.html.erb +1 -1
- data/app/components/avo/index/resource_grid_component.rb +0 -1
- data/app/components/avo/index/resource_table_component.html.erb +1 -1
- data/app/components/avo/index/resource_table_component.rb +0 -1
- data/app/components/avo/index/table_row_component.html.erb +1 -1
- data/app/components/avo/index/table_row_component.rb +0 -1
- data/app/components/avo/resource_component.rb +2 -2
- data/lib/avo/base_resource.rb +3 -3
- data/lib/avo/version.rb +1 -1
- metadata +2 -3
- data/lib/avo/concerns/can_reorder_items.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be0ab5eedf308bd4f5a7e3e9c839f9481b004e3213c7e78c54452b497a0b21ca
|
4
|
+
data.tar.gz: 4d9483b58abf6e0ec4b14db8ba3a97e82f3b37112c6fca1c99b89a5f62dda1b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72333502f4561bbfad1d6a1596714fba65455278bb05b5b1737bce0e0556df9f841a035f8cf93683cbea0994259a1dc6939c12c0f75375f0664769c8b21359d6
|
7
|
+
data.tar.gz: 46f66e0d93f76a73d748fbae12fc2354aac0b867fa427878e378912e7c3df9ef7f8b38e1fc39ac5bc9c1deb930441076ab362703622397be3e2f01ce9e6d7a51
|
data/Gemfile.lock
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<%== item_selector_init @resource %>
|
5
5
|
data-resource-name="<%= @resource.class.to_s %>"
|
6
6
|
data-record-id="<%= @resource.record.id %>"
|
7
|
-
<%= drag_reorder_item_attributes %>
|
7
|
+
<%= try :drag_reorder_item_attributes %>
|
8
8
|
>
|
9
9
|
<%= content_tag :div,
|
10
10
|
class: "relative w-full pb-3/4 rounded-t overflow-hidden #{html(:cover, :classes)}",
|
@@ -1,9 +1,4 @@
|
|
1
1
|
<div class="space-x-2 flex flex-row justify-end w-full">
|
2
|
-
<% if can_dnd_reorder? %>
|
3
|
-
<div class="handle">
|
4
|
-
<%= helpers.svg 'heroicons/outline/bars-3', class: 'text-gray-400 h-6 hover:text-gray-600 cursor-pointer' %>
|
5
|
-
</div>
|
6
|
-
<% end %>
|
7
2
|
<% @resource.render_row_controls(item: singular_resource_name).each do |control| %>
|
8
3
|
<%= render_control control %>
|
9
4
|
<% end %>
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
|
4
4
|
include Avo::ApplicationHelper
|
5
|
-
include Avo::Concerns::CanReorderItems
|
6
5
|
|
7
6
|
def initialize(resource: nil, reflection: nil, parent_record: nil, parent_resource: nil, view_type: :table, actions: nil)
|
8
7
|
@resource = resource
|
@@ -162,7 +161,7 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
|
|
162
161
|
end
|
163
162
|
|
164
163
|
def render_order_controls(control)
|
165
|
-
if can_reorder?
|
164
|
+
if try(:can_reorder?)
|
166
165
|
render Avo::Pro::Ordering::ButtonsComponent.new resource: @resource, reflection: @reflection, view_type: @view_type
|
167
166
|
end
|
168
167
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if @resources.present? %>
|
2
2
|
<turbo-frame id="<%= @resource.model_key %>_list" target="_top" class="relative w-full">
|
3
3
|
<div class="w-full grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-6 mt-8"
|
4
|
-
<%= drag_reorder_attributes %>
|
4
|
+
<%= try :drag_reorder_attributes %>
|
5
5
|
data-component-name="<%= self.class.to_s.underscore %>"
|
6
6
|
data-selected-resources-name="<%= @resource.model_key %>" data-selected-resources="[]">
|
7
7
|
<% @resources.each_with_index do |resource, index| %>
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Avo::Index::ResourceGridComponent < Avo::BaseComponent
|
4
|
-
include Avo::Concerns::CanReorderItems
|
5
4
|
attr_reader :actions
|
6
5
|
|
7
6
|
def initialize(resources: nil, resource: nil, reflection: nil, parent_record: nil, parent_resource: nil, actions: nil)
|
@@ -39,7 +39,7 @@
|
|
39
39
|
<% end %>
|
40
40
|
<table class="w-full px-4 bg-white">
|
41
41
|
<%= render partial: 'avo/partials/table_header', locals: {fields: @resource.get_fields(reflection: @reflection, only_root: true)} %>
|
42
|
-
<tbody class="divide-y" <%= drag_reorder_attributes %>>
|
42
|
+
<tbody class="divide-y" <%= try :drag_reorder_attributes %>>
|
43
43
|
<% @resources.each_with_index do |resource, index| %>
|
44
44
|
<% cache_if Avo.configuration.cache_resources_on_index_view, resource.cache_hash(@parent_record), expires_in: 1.day do %>
|
45
45
|
<%= render Avo::Index::TableRowComponent.new(resource: resource, reflection: @reflection, parent_record: @parent_record, parent_resource: @parent_resource, actions: @actions) %>
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
class Avo::Index::ResourceTableComponent < Avo::BaseComponent
|
4
4
|
include Avo::ApplicationHelper
|
5
|
-
include Avo::Concerns::CanReorderItems
|
6
5
|
attr_reader :pagy, :query
|
7
6
|
|
8
7
|
def initialize(resources: nil, resource: nil, reflection: nil, parent_record: nil, parent_resource: nil, pagy: nil, query: nil, actions: nil)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<%== item_selector_init @resource %>
|
6
6
|
data-resource-name="<%= @resource.class.to_s %>"
|
7
7
|
data-record-id="<%= @resource.record.id %>"
|
8
|
-
<%= drag_reorder_item_attributes %>
|
8
|
+
<%= try :drag_reorder_item_attributes %>
|
9
9
|
>
|
10
10
|
<% if @resource.record_selector %>
|
11
11
|
<td class="w-10">
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class Avo::ResourceComponent < Avo::BaseComponent
|
2
|
+
include Avo::Concerns::ChecksAssocAuthorization
|
3
|
+
|
2
4
|
attr_reader :fields_by_panel
|
3
5
|
attr_reader :has_one_panels
|
4
6
|
attr_reader :has_many_panels
|
@@ -7,8 +9,6 @@ class Avo::ResourceComponent < Avo::BaseComponent
|
|
7
9
|
attr_reader :resource
|
8
10
|
attr_reader :view
|
9
11
|
|
10
|
-
include Avo::Concerns::ChecksAssocAuthorization
|
11
|
-
|
12
12
|
def can_create?
|
13
13
|
return authorize_association_for(:create) if @reflection.present?
|
14
14
|
|
data/lib/avo/base_resource.rb
CHANGED
@@ -451,14 +451,14 @@ module Avo
|
|
451
451
|
def file_hash
|
452
452
|
content_to_be_hashed = ""
|
453
453
|
|
454
|
-
|
455
|
-
resource_path = Rails.root.join("app", "avo", "resources", "#{
|
454
|
+
file_name = self.class.underscore_name.tr(" ", "_")
|
455
|
+
resource_path = Rails.root.join("app", "avo", "resources", "#{file_name}.rb").to_s
|
456
456
|
if File.file? resource_path
|
457
457
|
content_to_be_hashed += File.read(resource_path)
|
458
458
|
end
|
459
459
|
|
460
460
|
# policy file hash
|
461
|
-
policy_path = Rails.root.join("app", "policies", "#{
|
461
|
+
policy_path = Rails.root.join("app", "policies", "#{file_name.gsub("_resource", "")}_policy.rb").to_s
|
462
462
|
if File.file? policy_path
|
463
463
|
content_to_be_hashed += File.read(policy_path)
|
464
464
|
end
|
data/lib/avo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-03-
|
13
|
+
date: 2024-03-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -2170,7 +2170,6 @@ files:
|
|
2170
2170
|
- lib/avo/base_resource_tool.rb
|
2171
2171
|
- lib/avo/concerns/borrow_items_holder.rb
|
2172
2172
|
- lib/avo/concerns/breadcrumbs.rb
|
2173
|
-
- lib/avo/concerns/can_reorder_items.rb
|
2174
2173
|
- lib/avo/concerns/can_replace_items.rb
|
2175
2174
|
- lib/avo/concerns/checks_assoc_authorization.rb
|
2176
2175
|
- lib/avo/concerns/filters_session_handler.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Concerns
|
3
|
-
module CanReorderItems
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
if defined? Avo::Pro::Concerns::CanReorderItems
|
8
|
-
include Avo::Pro::Concerns::CanReorderItems
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def can_reorder?
|
13
|
-
false
|
14
|
-
end
|
15
|
-
|
16
|
-
def can_dnd_reorder?
|
17
|
-
false
|
18
|
-
end
|
19
|
-
|
20
|
-
def drag_reorder_attributes
|
21
|
-
""
|
22
|
-
end
|
23
|
-
|
24
|
-
def drag_reorder_item_attributes
|
25
|
-
""
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|