avo 2.1.2.pre1 → 2.1.2.pre2
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/app/components/avo/filters_component.html.erb +19 -20
- data/app/components/avo/sidebar_profile_component.html.erb +14 -10
- data/lib/avo/app.rb +7 -3
- data/lib/avo/base_resource.rb +3 -0
- data/lib/avo/dynamic_router.rb +1 -1
- data/lib/avo/engine.rb +7 -16
- data/lib/avo/reloader.rb +51 -0
- data/lib/avo/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bde8997aaf953104f34a221e6be3c93b6c7f20bc1b9f125615c0ff994cc6791f
|
4
|
+
data.tar.gz: ca3a39976e8046d165cdb66a8aad6260e98d869981e73eba1d6d121bb57a7580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50c30c580b89ad850a34c0125ad0079d34a1af72eefbb99193644f605692ea5f3e2bb54e1a0032ef04e219ba84888171cfcf6b69c6da045475f21afc50747680
|
7
|
+
data.tar.gz: 0ce0f8be40b683c2c1ef5b8e963bbbb0d8282e4e0b7d193f4acedee530d9618481a036a0c3955214d4c024876a374009c82df85a788708aebf603943595218c1
|
data/Gemfile.lock
CHANGED
@@ -7,31 +7,30 @@
|
|
7
7
|
title: t('avo.click_to_reveal_filters'),
|
8
8
|
'data-button': 'resource-filters',
|
9
9
|
'data-action': 'click->toggle-panel#togglePanel',
|
10
|
-
'data-tippy': 'tooltip' do
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
'data-tippy': 'tooltip' do %>
|
11
|
+
<%= t 'avo.filters' %>
|
12
|
+
<% if params[:filters].present? %>
|
13
|
+
<span class="ml-1">(<%=JSON.parse(Base64.decode64(params[:filters])).count%> applied)</span>
|
14
|
+
<% end %>
|
15
15
|
<% end %>
|
16
|
-
|
17
|
-
<div
|
16
|
+
<div
|
18
17
|
class="absolute block inset-auto sm:right-0 top-full bg-white min-w-[300px] mt-2 z-20 shadow-modal rounded hidden divide-y divide-gray-300"
|
19
18
|
data-toggle-panel-target="panel"
|
20
19
|
>
|
21
|
-
|
22
|
-
|
23
|
-
<% end %>
|
24
|
-
<div class="p-4 border-gray-300 border-t">
|
25
|
-
<% if params[:filters].present? %>
|
26
|
-
<%= a_link helpers.resources_path(resource: @resource, filters: nil, keep_query_params: true), color: :gray, size: :sm, class: 'w-full justify-center' do %>
|
27
|
-
<%= t('avo.reset_filters') %>
|
28
|
-
<% end %>
|
29
|
-
<% else %>
|
30
|
-
<%= a_button class: 'w-full justify-center', disabled: true do %>
|
31
|
-
<%= t('avo.reset_filters') %>
|
32
|
-
<% end %>
|
20
|
+
<% @filters.each do |filter| %>
|
21
|
+
<%= render partial: filter.class.template, locals: {filter: filter} %>
|
33
22
|
<% end %>
|
23
|
+
<div class="p-4 border-gray-300 border-t">
|
24
|
+
<% if params[:filters].present? %>
|
25
|
+
<%= a_link helpers.resources_path(resource: @resource, filters: nil, keep_query_params: true), color: :gray, size: :sm, class: 'w-full justify-center' do %>
|
26
|
+
<%= t('avo.reset_filters') %>
|
27
|
+
<% end %>
|
28
|
+
<% else %>
|
29
|
+
<%= a_button class: 'w-full justify-center', disabled: true do %>
|
30
|
+
<%= t('avo.reset_filters') %>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
</div>
|
34
34
|
</div>
|
35
35
|
</div>
|
36
36
|
</div>
|
37
|
-
</div>
|
@@ -1,19 +1,23 @@
|
|
1
1
|
<div class="text-black border-t border-gray-200 p-4 flex">
|
2
2
|
<div class="flex-1 flex space-x-4">
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
<% if avatar.present? %>
|
4
|
+
<div class="relative aspect-square w-10 h-10 overflow-hidden rounded">
|
5
|
+
<%= image_tag avatar, class: "object-cover min-w-full min-h-full h-full" %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
6
8
|
<div class="flex flex-col">
|
7
9
|
<div class="font-medium">
|
8
10
|
<%= name %>
|
9
11
|
</div>
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
<% if title.present? %>
|
13
|
+
<div class="text-xs text-gray-500 uppercase">
|
14
|
+
<%= title %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
13
17
|
</div>
|
14
18
|
</div>
|
15
|
-
|
16
|
-
|
19
|
+
<% if can_destroy_user? %>
|
20
|
+
<div class="relative" data-controller="toggle-panel">
|
17
21
|
<a class="flex items-center h-full cursor-pointer" data-control="profile-dots" data-action="click->toggle-panel#togglePanel">
|
18
22
|
<%= helpers.svg 'three-dots', class: 'h-4' %>
|
19
23
|
</a>
|
@@ -31,6 +35,6 @@
|
|
31
35
|
<%= helpers.svg 'logout', class: 'h-4 mr-1' %> <%= t('avo.sign_out') %>
|
32
36
|
<% end %>
|
33
37
|
</div>
|
34
|
-
|
35
|
-
|
38
|
+
</div>
|
39
|
+
<% end %>
|
36
40
|
</div>
|
data/lib/avo/app.rb
CHANGED
@@ -79,12 +79,16 @@ module Avo
|
|
79
79
|
def init_resources
|
80
80
|
self.resources = BaseResource.descendants
|
81
81
|
.select do |resource|
|
82
|
+
# Remove the BaseResource. We only need the descendants
|
82
83
|
resource != BaseResource
|
83
84
|
end
|
85
|
+
.uniq do |klass|
|
86
|
+
# On invalid resource configuration the resource classes get duplicated in `ObjectSpace`
|
87
|
+
# We need to de-duplicate them
|
88
|
+
klass.name
|
89
|
+
end
|
84
90
|
.map do |resource|
|
85
|
-
if resource.is_a? Class
|
86
|
-
resource.new
|
87
|
-
end
|
91
|
+
resource.new if resource.is_a? Class
|
88
92
|
end
|
89
93
|
end
|
90
94
|
|
data/lib/avo/base_resource.rb
CHANGED
data/lib/avo/dynamic_router.rb
CHANGED
data/lib/avo/engine.rb
CHANGED
@@ -19,7 +19,8 @@ module Avo
|
|
19
19
|
|
20
20
|
config.i18n.load_path += Dir[Avo::Engine.root.join('lib', 'generators', 'avo', 'templates', 'locales', '*.{rb,yml}')]
|
21
21
|
|
22
|
-
initializer "avo.autoload", before: :set_autoload_paths do |app|
|
22
|
+
# initializer "avo.autoload", before: :set_autoload_paths do |app|
|
23
|
+
initializer "avo.autoload" do |app|
|
23
24
|
[
|
24
25
|
["app", "avo", "fields"],
|
25
26
|
["app", "avo", "filters"],
|
@@ -41,21 +42,11 @@ module Avo
|
|
41
42
|
::Avo::App.init_fields
|
42
43
|
end
|
43
44
|
|
44
|
-
initializer "avo.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
app.
|
49
|
-
# Register reloader
|
50
|
-
app.reloaders << app.config.file_watcher.new([], {
|
51
|
-
Avo::Engine.root.join("lib", "avo").to_s => ["rb"]
|
52
|
-
}) {}
|
53
|
-
|
54
|
-
# What to do on file change
|
55
|
-
config.to_prepare do
|
56
|
-
Dir.glob(avo_root_path + "/lib/avo/**/*.rb".to_s).each { |c| load c }
|
57
|
-
Avo::App.boot
|
58
|
-
end
|
45
|
+
initializer "avo.reloader" do |app|
|
46
|
+
Avo::Reloader.new.tap do |reloader|
|
47
|
+
reloader.execute
|
48
|
+
app.reloaders << reloader
|
49
|
+
app.reloader.to_run { reloader.execute }
|
59
50
|
end
|
60
51
|
end
|
61
52
|
|
data/lib/avo/reloader.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
class Avo::Reloader
|
2
|
+
delegate :execute_if_updated, :execute, :updated?, to: :updater
|
3
|
+
|
4
|
+
def reload!
|
5
|
+
# reload all files declared in paths
|
6
|
+
paths.each { |path| load path }
|
7
|
+
|
8
|
+
# reload all files declared in each directory
|
9
|
+
directories.keys.each do |dir|
|
10
|
+
Dir.glob("#{dir}/**/*.rb".to_s).each { |c| load c }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def updater
|
16
|
+
@updater ||= config.file_watcher.new(paths, directories) { reload! }
|
17
|
+
end
|
18
|
+
|
19
|
+
def paths
|
20
|
+
# we want to watch some files no matter what
|
21
|
+
files = [
|
22
|
+
Rails.root.join("config", "initializers", "avo.rb"),
|
23
|
+
]
|
24
|
+
|
25
|
+
# we want to watch some files only in Avo development
|
26
|
+
if reload_lib?
|
27
|
+
files += []
|
28
|
+
end
|
29
|
+
|
30
|
+
files
|
31
|
+
end
|
32
|
+
|
33
|
+
def directories
|
34
|
+
dirs = {}
|
35
|
+
|
36
|
+
# watch the lib directory in Avo development
|
37
|
+
if reload_lib?
|
38
|
+
dirs[Avo::Engine.root.join("lib", "avo").to_s] = ["rb"]
|
39
|
+
end
|
40
|
+
|
41
|
+
dirs
|
42
|
+
end
|
43
|
+
|
44
|
+
def config
|
45
|
+
Rails.application.config
|
46
|
+
end
|
47
|
+
|
48
|
+
def reload_lib?
|
49
|
+
Avo::IN_DEVELOPMENT || ENV['AVO_RELOAD_LIB_DIR']
|
50
|
+
end
|
51
|
+
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: 2.1.2.
|
4
|
+
version: 2.1.2.pre2
|
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: 2022-04-
|
12
|
+
date: 2022-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -1193,6 +1193,7 @@ files:
|
|
1193
1193
|
- lib/avo/loaders/fields_loader.rb
|
1194
1194
|
- lib/avo/loaders/filters_loader.rb
|
1195
1195
|
- lib/avo/loaders/loader.rb
|
1196
|
+
- lib/avo/reloader.rb
|
1196
1197
|
- lib/avo/services/authorization_service.rb
|
1197
1198
|
- lib/avo/tools_manager.rb
|
1198
1199
|
- lib/avo/version.rb
|