avo 2.15.2.pre.1 → 2.15.3.pre.1.data.attrs.to.sidebar.items
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/sidebar/item_switcher_component.html.erb +3 -3
- data/app/components/avo/sidebar/link_component.html.erb +2 -2
- data/app/components/avo/sidebar/link_component.rb +3 -1
- data/lib/avo/menu/base_item.rb +1 -0
- data/lib/avo/menu/builder.rb +4 -2
- data/lib/avo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64729fc8e5570fcc659daa51c57938d6b75690ab2952fa054149e7208c064e5a
|
4
|
+
data.tar.gz: 373621511d2f61b098add0594a1cfdfb687f1587ac7a6e3c1f1c388b663146fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36b5950de108a20d8fa2dd24e68022d7eee35d16bb9cd07e926748c887e3bc42d42fb6ef36d3932e60c31fbbf2860a1aee6af035287515393e20619be4c59f62
|
7
|
+
data.tar.gz: e047c958831467741cb77c330b8fe62df5349b40fee2f5de42e2965e11587dc193d2266883c217d1d9b529536264101aa76fb41d884008e9ca8d192b0d33928d
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
<% if item.is_a? Avo::Menu::Link %>
|
2
|
-
<%= render Avo::Sidebar::LinkComponent.new label: item.name, path: item.path, target: item.target %>
|
2
|
+
<%= render Avo::Sidebar::LinkComponent.new label: item.name, path: item.path, target: item.target, data: item.data %>
|
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) %>
|
5
|
+
<%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: helpers.resources_path(resource: resource), data: item.data %>
|
6
6
|
<% end %>
|
7
7
|
<% if item.is_a? Avo::Menu::Dashboard %>
|
8
|
-
<%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: dashboard.navigation_path %>
|
8
|
+
<%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: dashboard.navigation_path, data: item.data %>
|
9
9
|
<% end %>
|
10
10
|
<% if item.is_a? Avo::Menu::Section %>
|
11
11
|
<%= render Avo::Sidebar::SectionComponent.new item: item %>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<% if path.present? %>
|
2
|
-
<%= send link_method, path, class: classes, active: active, target: target do %>
|
2
|
+
<%= send link_method, path, class: classes, active: active, target: target, data: data do %>
|
3
3
|
<%= label %>
|
4
4
|
<% if target == :_blank %>
|
5
5
|
<%= helpers.svg('heroicons/outline/external-link', class: 'self-center ml-auto h-3 mr-2') %>
|
6
6
|
<% end %>
|
7
7
|
<% end %>
|
8
8
|
<% else %>
|
9
|
-
<%= content_tag :div, class: classes, active: active, target: target do %>
|
9
|
+
<%= content_tag :div, class: classes, active: active, target: target, data: data do %>
|
10
10
|
<%= label %>
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
@@ -5,12 +5,14 @@ class Avo::Sidebar::LinkComponent < ViewComponent::Base
|
|
5
5
|
attr_reader :target
|
6
6
|
attr_reader :label
|
7
7
|
attr_reader :path
|
8
|
+
attr_reader :data
|
8
9
|
|
9
|
-
def initialize(label: nil, path: nil, active: :inclusive, target: nil)
|
10
|
+
def initialize(label: nil, path: nil, active: :inclusive, target: nil, data: {})
|
10
11
|
@label = label
|
11
12
|
@path = path
|
12
13
|
@active = active
|
13
14
|
@target = target
|
15
|
+
@data = data
|
14
16
|
end
|
15
17
|
|
16
18
|
def is_external?
|
data/lib/avo/menu/base_item.rb
CHANGED
data/lib/avo/menu/builder.rb
CHANGED
@@ -22,9 +22,11 @@ class Avo::Menu::Builder
|
|
22
22
|
end
|
23
23
|
|
24
24
|
# Adds a link
|
25
|
-
def link(name, **args)
|
26
|
-
|
25
|
+
def link(name, path = nil, **args)
|
26
|
+
path ||= args[:path]
|
27
|
+
@menu.items << Avo::Menu::Link.new(name: name, path: path, **args)
|
27
28
|
end
|
29
|
+
alias_method :link_to, :link
|
28
30
|
|
29
31
|
# Validates and adds a resource
|
30
32
|
def resource(name, **args)
|
data/lib/avo/version.rb
CHANGED