avo 2.34.0 → 2.34.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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/components/avo/profile_item_component.html.erb +17 -2
- data/app/components/avo/profile_item_component.rb +13 -1
- data/app/components/avo/sidebar_profile_component.html.erb +20 -21
- data/app/views/avo/partials/_profile_menu_extra.html.erb +2 -0
- data/lib/avo/fields/belongs_to_field.rb +2 -2
- data/lib/avo/menu/link.rb +2 -0
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/eject_generator.rb +1 -0
- 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: 7b1b2bdba8e863c5c01a069056bf4fd5ac98fd45ebfb8ed9e70c3f5a9da05380
|
4
|
+
data.tar.gz: cb6e887b63ea5992da6233b8323df13427478f37e0805945903d1d52c2302342
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86d3aa5189e477e66095b2d648010fbbe9ee5b7d5cc4b38c1c5b10b709a139dff14a60bb9a1cab97ceea62edc5c37d48bb40c657fc6f774412911cc00474d098
|
7
|
+
data.tar.gz: 64b9694b95826f77faf2a1e56023522809923c9aedcf646f2622db44da537403bcadded775d3935bb91226d1eb5868c8c6f967195c4957ad18f95e1efdba95e4
|
data/Gemfile.lock
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
-
|
2
|
-
<%=
|
1
|
+
<% if method.present? %>
|
2
|
+
<%= button_to path,
|
3
|
+
form_class: "flex-1 flex",
|
4
|
+
class: button_classes,
|
5
|
+
target: target,
|
6
|
+
title: title,
|
7
|
+
method: method,
|
8
|
+
params: params do %>
|
9
|
+
<%= helpers.svg(icon, class: 'h-4 mr-1') if icon.present? %> <%= label %>
|
10
|
+
<% end %>
|
11
|
+
<% else %>
|
12
|
+
<%= link_to path,
|
13
|
+
class: button_classes,
|
14
|
+
target: target,
|
15
|
+
title: title do %>
|
16
|
+
<%= helpers.svg(icon, class: 'h-4 mr-1') if icon.present? %> <%= label %>
|
17
|
+
<% end %>
|
3
18
|
<% end %>
|
@@ -6,17 +6,29 @@ class Avo::ProfileItemComponent < ViewComponent::Base
|
|
6
6
|
attr_reader :path
|
7
7
|
attr_reader :active
|
8
8
|
attr_reader :target
|
9
|
+
attr_reader :method
|
10
|
+
attr_reader :params
|
11
|
+
attr_reader :classes
|
9
12
|
|
10
|
-
def initialize(label: nil, icon: nil, path: nil, active: :inclusive, target: nil, title: nil)
|
13
|
+
def initialize(label: nil, icon: nil, path: nil, active: :inclusive, target: nil, title: nil, method: nil, params: {}, classes: "")
|
11
14
|
@label = label
|
12
15
|
@icon = icon
|
13
16
|
@path = path
|
14
17
|
@active = active
|
15
18
|
@target = target
|
16
19
|
@title = title
|
20
|
+
@method = method
|
21
|
+
@params = params
|
22
|
+
@classes = classes
|
17
23
|
end
|
18
24
|
|
19
25
|
def title
|
20
26
|
@title || @label
|
21
27
|
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def button_classes
|
32
|
+
"flex-1 flex items-center justify-center bg-white text-left cursor-pointer text-gray-800 font-semibold hover:bg-primary-100 block px-4 py-1 w-full py-3 text-center rounded w-full"
|
33
|
+
end
|
22
34
|
end
|
@@ -16,26 +16,25 @@
|
|
16
16
|
<% end %>
|
17
17
|
</div>
|
18
18
|
</div>
|
19
|
-
|
20
|
-
<
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<% Avo::
|
31
|
-
|
32
|
-
<%= render Avo::ProfileItemComponent.new label: item.name, path: item.path, icon: item.icon %>
|
33
|
-
<% end %>
|
19
|
+
<div class="relative" data-controller="toggle-panel">
|
20
|
+
<a class="flex items-center h-full cursor-pointer" data-control="profile-dots" data-action="click->toggle-panel#togglePanel">
|
21
|
+
<%= helpers.svg 'three-dots', class: 'h-4' %>
|
22
|
+
</a>
|
23
|
+
<div
|
24
|
+
class="hidden absolute flex flex-col inset-auto right-0 -mt-12 bg-white rounded min-w-[200px] shadow-context -translate-y-full z-40"
|
25
|
+
data-toggle-panel-target="panel"
|
26
|
+
>
|
27
|
+
<% if Avo::App.has_profile_menu? %>
|
28
|
+
<div class="text-black">
|
29
|
+
<% Avo::App.profile_menu.items.each do |item| %>
|
30
|
+
<% if item.is_a? Avo::Menu::Link %>
|
31
|
+
<%= render Avo::ProfileItemComponent.new label: item.name, path: item.path, icon: item.icon, method: item.method, params: item.params %>
|
34
32
|
<% end %>
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
<%= render "avo/partials/profile_menu_extra" %>
|
37
|
+
<% if can_destroy_user? %>
|
39
38
|
<%= button_to helpers.main_app.send(destroy_user_session_path),
|
40
39
|
form: { "data-turbo" => "false" },
|
41
40
|
method: :delete,
|
@@ -46,7 +45,7 @@
|
|
46
45
|
form_class: 'flex-1' do %>
|
47
46
|
<%= helpers.svg 'logout', class: 'h-4 mr-1' %> <%= t('avo.sign_out') %>
|
48
47
|
<% end %>
|
49
|
-
|
48
|
+
<% end %>
|
50
49
|
</div>
|
51
|
-
|
50
|
+
</div>
|
52
51
|
</div>
|
@@ -199,9 +199,9 @@ module Avo
|
|
199
199
|
def fill_field(model, key, value, params)
|
200
200
|
return model unless model.methods.include? key.to_sym
|
201
201
|
|
202
|
-
valid_model_class = valid_polymorphic_class params["#{polymorphic_as}_type"]
|
203
|
-
|
204
202
|
if polymorphic_as.present?
|
203
|
+
valid_model_class = valid_polymorphic_class params["#{polymorphic_as}_type"]
|
204
|
+
|
205
205
|
model.send("#{polymorphic_as}_type=", valid_model_class)
|
206
206
|
|
207
207
|
# If the type is blank, reset the id too.
|
data/lib/avo/menu/link.rb
CHANGED
data/lib/avo/version.rb
CHANGED
@@ -17,6 +17,7 @@ module Generators
|
|
17
17
|
pre_head: "app/views/avo/partials/_pre_head.html.erb",
|
18
18
|
scripts: "app/views/avo/partials/_scripts.html.erb",
|
19
19
|
sidebar_extra: "app/views/avo/partials/_sidebar_extra.html.erb",
|
20
|
+
profile_menu_extra: "app/views/avo/partials/_profile_menu_extra.html.erb",
|
20
21
|
}
|
21
22
|
|
22
23
|
def handle
|
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.34.
|
4
|
+
version: 2.34.2
|
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-06-
|
12
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -1687,6 +1687,7 @@ files:
|
|
1687
1687
|
- app/views/avo/partials/_logo.html.erb
|
1688
1688
|
- app/views/avo/partials/_navbar.html.erb
|
1689
1689
|
- app/views/avo/partials/_pre_head.html.erb
|
1690
|
+
- app/views/avo/partials/_profile_menu_extra.html.erb
|
1690
1691
|
- app/views/avo/partials/_resource_search.html.erb
|
1691
1692
|
- app/views/avo/partials/_scripts.html.erb
|
1692
1693
|
- app/views/avo/partials/_sidebar_extra.html.erb
|