avo 2.41.0 → 2.42.0
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/README.md +1 -1
- data/app/components/avo/fields/common/files/list_viewer_component.rb +3 -3
- data/app/components/avo/fields/common/files/view_type/{grid_component.html.erb → grid_item_component.html.erb} +2 -2
- data/app/components/avo/fields/common/files/view_type/{grid_component.rb → grid_item_component.rb} +3 -2
- data/app/components/avo/fields/common/files/view_type/{list_component.rb → list_item_component.rb} +1 -1
- data/app/components/avo/fields/file_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/file_field/show_component.html.erb +1 -1
- data/app/components/avo/sidebar/item_switcher_component.html.erb +1 -1
- data/lib/avo/app.rb +2 -2
- data/lib/avo/concerns/fetches_things.rb +6 -1
- data/lib/avo/menu/resource.rb +9 -1
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/tailwindcss/install_generator.rb +15 -1
- metadata +6 -6
- /data/app/components/avo/fields/common/files/view_type/{list_component.html.erb → list_item_component.html.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0799a57f6727740259635d229244cc855fe5061c4df01ba3364e55dd8ae90b91'
|
4
|
+
data.tar.gz: b0ced097b17c2d00de2700b06918c5042d71b6e834b30462db56df2a4132fc91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17cd3153759eae7461997075ee027344ecc5a7dca2dfce976136a0a826c63016d6c8162fa7c3c790ddda335e69933f9199dbb17b920dd3d56a8cc7324ca3916d
|
7
|
+
data.tar.gz: edd52068c4f944febe1d4df905fed454929497264e156fbb2202bd0d7ac39ed33a6d723295e3c47734fd8de02e61c543e26cb19fde146e6653822ec3deea3286
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Avo is a beautiful next-generation framework that empowers you, the developer, t
|
|
17
17
|
✨ **Website**: [avohq.io](https://avohq.io)\
|
18
18
|
📚 **Documentation**: [docs.avohq.io](https://docs.avohq.io)\
|
19
19
|
🗺 **Roadmap**: [GitHub Roadmap](https://github.com/orgs/avo-hq/projects/3)\
|
20
|
-
🎸 **Demo app**: [Avodemo](https://avodemo.
|
20
|
+
🎸 **Demo app**: [Avodemo](https://main.avodemo.com/)\
|
21
21
|
🐤 **Twitter**: [avo_hq](https://twitter.com/avo_hq)\
|
22
22
|
💬 **Community chat**: [discord](https://discord.gg/pkTF6y8)\
|
23
23
|
🔧 **Issue tracker**: [GitHub issues](http://github.com/avo-hq/avo/issues)\
|
@@ -31,11 +31,11 @@ class Avo::Fields::Common::Files::ListViewerComponent < ViewComponent::Base
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def view_type_component(file)
|
34
|
-
component = "Avo::Fields::Common::Files::ViewType::#{view_type.to_s.capitalize}
|
35
|
-
component.new(field: field, resource: resource, file: file)
|
34
|
+
component = "Avo::Fields::Common::Files::ViewType::#{view_type.to_s.capitalize}ItemComponent".constantize
|
35
|
+
component.new(field: field, resource: resource, file: file, extra_classes: "aspect-video")
|
36
36
|
end
|
37
37
|
|
38
38
|
def view_type
|
39
|
-
(resource.params.dig(:view_type) || field.view_type).to_sym
|
39
|
+
@view_type ||= (resource.params.dig(:view_type) || field.view_type).to_sym
|
40
40
|
end
|
41
41
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<div id="<%= dom_id file %>" class="relative min-h-full max-w-full flex-1 flex flex-col justify-between space-y-2">
|
2
2
|
<% if file.present? %>
|
3
|
-
<div class="flex
|
3
|
+
<div class="flex h-full">
|
4
4
|
<% if file.representable? && is_image? %>
|
5
|
-
<%= image_tag helpers.main_app.url_for(file), class:
|
5
|
+
<%= image_tag helpers.main_app.url_for(file), class: "rounded-lg max-w-full #{@extra_classes}" %>
|
6
6
|
<% elsif is_audio? %>
|
7
7
|
<%= audio_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
|
8
8
|
<% elsif is_video? %>
|
data/app/components/avo/fields/common/files/view_type/{grid_component.rb → grid_item_component.rb}
RENAMED
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Avo::Fields::Common::Files::ViewType::
|
3
|
+
class Avo::Fields::Common::Files::ViewType::GridItemComponent < ViewComponent::Base
|
4
4
|
attr_reader :field, :resource
|
5
5
|
|
6
|
-
def initialize(field:, resource:, file: nil)
|
6
|
+
def initialize(field:, resource:, file: nil, extra_classes: nil)
|
7
7
|
@file = file
|
8
8
|
@field = field
|
9
9
|
@resource = resource
|
10
|
+
@extra_classes = extra_classes
|
10
11
|
end
|
11
12
|
|
12
13
|
def id
|
data/app/components/avo/fields/common/files/view_type/{list_component.rb → list_item_component.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Avo::Fields::Common::Files::ViewType::
|
3
|
+
class Avo::Fields::Common::Files::ViewType::ListItemComponent < Avo::Fields::Common::Files::ViewType::GridItemComponent
|
4
4
|
def icon_for_file
|
5
5
|
if is_image?
|
6
6
|
"photo"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args do %>
|
2
2
|
<% if @field.value.present? %>
|
3
3
|
<div class="mb-2">
|
4
|
-
<%= render Avo::Fields::Common::Files::ViewType::
|
4
|
+
<%= render Avo::Fields::Common::Files::ViewType::GridItemComponent.new resource: @resource, field: @field %>
|
5
5
|
</div>
|
6
6
|
<% end %>
|
7
7
|
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args do %>
|
2
|
-
<%= render Avo::Fields::Common::Files::ViewType::
|
2
|
+
<%= render Avo::Fields::Common::Files::ViewType::GridItemComponent.new resource: @resource, field: @field %>
|
3
3
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= render Avo::Sidebar::LinkComponent.new label: item.name, path: item.path, target: item.target, data: item.data, icon: item.icon %>
|
3
3
|
<% end %>
|
4
4
|
<% if item.is_a? Avo::Menu::Resource %>
|
5
|
-
<%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: helpers.resources_path(resource: resource), data: item.data, icon: item.icon %>
|
5
|
+
<%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: helpers.resources_path(resource: resource, **item.fetch_params), data: item.data, icon: item.icon %>
|
6
6
|
<% end %>
|
7
7
|
<% if item.is_a? Avo::Menu::Dashboard %>
|
8
8
|
<%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: dashboard.navigation_path, data: item.data, icon: item.icon %>
|
data/lib/avo/app.rb
CHANGED
@@ -35,7 +35,7 @@ module Avo
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# When not in production we'll just use the MemoryStore which is good enough.
|
38
|
-
#
|
38
|
+
# When running in production we'll try to use memcached or redis if available.
|
39
39
|
# If not, we'll use the FileStore.
|
40
40
|
# We decided against the MemoryStore in production because it will not be shared between multiple processes (when using Puma).
|
41
41
|
def get_cache_store
|
@@ -53,7 +53,7 @@ module Avo
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
#
|
56
|
+
# Generate a dynamic root path using the URIService
|
57
57
|
def root_path(paths: [], query: {}, **args)
|
58
58
|
Avo::Services::URIService.parse(view_context.avo.root_url.to_s)
|
59
59
|
.append_paths(paths)
|
@@ -89,7 +89,12 @@ module Avo
|
|
89
89
|
def get_available_resources(user = nil)
|
90
90
|
valid_resources
|
91
91
|
.select do |resource|
|
92
|
-
|
92
|
+
resource.authorization.class.authorize(
|
93
|
+
user,
|
94
|
+
resource.model_class,
|
95
|
+
Avo.configuration.authorization_methods.stringify_keys["index"],
|
96
|
+
raise_exception: false
|
97
|
+
)
|
93
98
|
end
|
94
99
|
.sort_by { |r| r.name }
|
95
100
|
end
|
data/lib/avo/menu/resource.rb
CHANGED
@@ -3,12 +3,20 @@ class Avo::Menu::Resource < Avo::Menu::BaseItem
|
|
3
3
|
|
4
4
|
option :resource
|
5
5
|
option :label, optional: true
|
6
|
+
option :params, default: proc { {} }
|
6
7
|
|
7
8
|
def parsed_resource
|
8
|
-
Avo::App.guess_resource resource.to_s
|
9
|
+
@parsed_resource ||= Avo::App.guess_resource resource.to_s
|
9
10
|
end
|
10
11
|
|
11
12
|
def entity_label
|
12
13
|
parsed_resource.navigation_label
|
13
14
|
end
|
15
|
+
|
16
|
+
def fetch_params
|
17
|
+
Avo::ExecutionContext.new(
|
18
|
+
target: params,
|
19
|
+
resource: parsed_resource
|
20
|
+
).handle
|
21
|
+
end
|
14
22
|
end
|
data/lib/avo/version.rb
CHANGED
@@ -39,11 +39,19 @@ module Generators
|
|
39
39
|
say "Adding the CSS asset to the partial"
|
40
40
|
prepend_to_file Rails.root.join("app", "views", "avo", "partials", "_pre_head.html.erb"), "<%= stylesheet_link_tag \"avo.tailwind.css\", media: \"all\" %>"
|
41
41
|
|
42
|
+
tailwind_script = setup_tailwind_script
|
42
43
|
say "Ensure you have the following script in your package.json file.", :yellow
|
43
|
-
say %("scripts": { "avo:tailwindcss": "
|
44
|
+
say %("scripts": { "avo:tailwindcss": "#{tailwind_script}" --minify }), :green
|
44
45
|
end
|
45
46
|
|
46
47
|
no_tasks do
|
48
|
+
def setup_tailwind_script
|
49
|
+
tailwind_config_path = tailwindcss_config_path()
|
50
|
+
tailwind_script = "tailwindcss -i ./app/assets/stylesheets/avo.tailwind.css -o ./app/assets/builds/avo.tailwind.css"
|
51
|
+
tailwind_script += " -c #{tailwind_config_path}" if tailwind_config_path
|
52
|
+
tailwind_script
|
53
|
+
end
|
54
|
+
|
47
55
|
def template_path(filename)
|
48
56
|
Pathname.new(__dir__).join("..", "templates", "tailwindcss", filename).to_s
|
49
57
|
end
|
@@ -51,6 +59,12 @@ module Generators
|
|
51
59
|
def tailwindcss_installed?
|
52
60
|
Rails.root.join("config", "tailwind.config.js").exist? || Rails.root.join("tailwind.config.js").exist?
|
53
61
|
end
|
62
|
+
|
63
|
+
def tailwindcss_config_path
|
64
|
+
if Rails.root.join("config", "tailwind.config.js").exist?
|
65
|
+
"./config/tailwind.config.js"
|
66
|
+
end
|
67
|
+
end
|
54
68
|
end
|
55
69
|
end
|
56
70
|
end
|
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: 2.
|
4
|
+
version: 2.42.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -1381,10 +1381,10 @@ files:
|
|
1381
1381
|
- app/components/avo/fields/common/files/controls_component.rb
|
1382
1382
|
- app/components/avo/fields/common/files/list_viewer_component.html.erb
|
1383
1383
|
- app/components/avo/fields/common/files/list_viewer_component.rb
|
1384
|
-
- app/components/avo/fields/common/files/view_type/
|
1385
|
-
- app/components/avo/fields/common/files/view_type/
|
1386
|
-
- app/components/avo/fields/common/files/view_type/
|
1387
|
-
- app/components/avo/fields/common/files/view_type/
|
1384
|
+
- app/components/avo/fields/common/files/view_type/grid_item_component.html.erb
|
1385
|
+
- app/components/avo/fields/common/files/view_type/grid_item_component.rb
|
1386
|
+
- app/components/avo/fields/common/files/view_type/list_item_component.html.erb
|
1387
|
+
- app/components/avo/fields/common/files/view_type/list_item_component.rb
|
1388
1388
|
- app/components/avo/fields/common/gravatar_viewer_component.html.erb
|
1389
1389
|
- app/components/avo/fields/common/gravatar_viewer_component.rb
|
1390
1390
|
- app/components/avo/fields/common/heading_component.html.erb
|
File without changes
|