lato 3.14.5 → 3.14.6
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c6664ab48177f66d9fb4290210f2d8390fe5b9c6bbbfd7ce90640edac41ed20
|
4
|
+
data.tar.gz: 7aae0d3c205a4207dce4499ff73870d0fd08c360a145fff08763c8e5181e0a25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 157174be653d6fb1030c1963ad66f77e54ec9d4bf69896ee7e29dd781dfb31744d1cb5a5782d73c604da161852fcb26f6ecdaf9ad8d3e43caf7898089d63fda9
|
7
|
+
data.tar.gz: 397e59f83ea024e125d97ded46a4616835ba8878bc0ab1f8c85d55d5e6d6e2d46ea682137db3171f987221da43ae2347d76699c4f51bafcb092a64da793a4341
|
@@ -51,6 +51,12 @@ document.addEventListener('turbo:before-cache', (e) => {
|
|
51
51
|
document.body.style.paddingRight = ''
|
52
52
|
document.body.style.overflow = ''
|
53
53
|
|
54
|
+
// close sidebar submenus
|
55
|
+
document.querySelectorAll('aside .nav-item .collapse.show').forEach((el) => {
|
56
|
+
if (el.querySelector('.nav-link.active')) return // keep open if contains active link
|
57
|
+
el.classList.remove('show')
|
58
|
+
})
|
59
|
+
|
54
60
|
// close nav menu (for mobile)
|
55
61
|
document.querySelector('.navbar-toggler').classList.add('collapsed')
|
56
62
|
document.querySelector('.navbar-collapse').classList.remove('show')
|
@@ -21,11 +21,21 @@ module Lato
|
|
21
21
|
# Sidebar
|
22
22
|
##
|
23
23
|
|
24
|
-
def lato_sidebar_nav_item(key, path, external: false, &block)
|
24
|
+
def lato_sidebar_nav_item(key, path, external: false, children: nil, &block)
|
25
25
|
active = request.path == path
|
26
26
|
active = @sidebar_key == key if @sidebar_key
|
27
|
+
|
28
|
+
# se ci sono children, verifico se uno di questi è attivo e assegno a active la key del child attivo
|
29
|
+
if children && children.is_a?(Array)
|
30
|
+
children.each do |child|
|
31
|
+
if request.path == child[:path] || (@sidebar_key && @sidebar_key == (child[:key] || key))
|
32
|
+
active = child[:key] || key
|
33
|
+
break
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
27
37
|
|
28
|
-
render 'lato/components/sidebar_nav_item', active: active, path: path, external: external do
|
38
|
+
render 'lato/components/sidebar_nav_item', key: key, active: active, path: path, external: external, children: children do
|
29
39
|
yield if block
|
30
40
|
end
|
31
41
|
end
|
@@ -1,18 +1,51 @@
|
|
1
1
|
<%
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
# Controlla se ci sono children da visualizzare
|
4
|
+
has_children = children&.any?
|
5
|
+
|
6
|
+
# Se non ci sono children, comportamento normale
|
7
|
+
unless has_children
|
8
|
+
link_to_options = {
|
9
|
+
class: ['nav-link position-relative', (active ? 'active' : 'link-dark')].join(' '),
|
10
|
+
}
|
11
|
+
link_to_options[:target] = '_blank' if external
|
12
|
+
end
|
7
13
|
|
8
14
|
%>
|
9
15
|
|
10
|
-
|
11
|
-
|
12
|
-
|
16
|
+
<% if has_children %>
|
17
|
+
<!-- Menu con dropdown per children -->
|
18
|
+
<li class="nav-item border-bottom py-2">
|
19
|
+
<div class="nav-link position-relative dropdown">
|
20
|
+
<a href="#" class="link-dark text-decoration-none dropdown-toggle d-flex align-items-center"
|
21
|
+
data-bs-toggle="collapse"
|
22
|
+
data-bs-target="#sidebar-nav-item-dropdown-<%= key || 'item' %>"
|
23
|
+
aria-expanded="<%= active ? 'true' : 'false' %>">
|
24
|
+
<%= yield %>
|
25
|
+
</a>
|
26
|
+
|
27
|
+
<div class="collapse <%= 'show' if active %>" id="sidebar-nav-item-dropdown-<%= key || 'item' %>">
|
28
|
+
<ul class="list-unstyled mt-2 border-start border-1 ps-2">
|
29
|
+
<% children.each do |child| %>
|
30
|
+
<li class="py-1">
|
31
|
+
<%= link_to child[:path], class: ['nav-link py-1', (active == child[:key] ? 'active' : 'link-dark')].join(' ') do %>
|
32
|
+
<%= child[:label] %>
|
33
|
+
<% end %>
|
34
|
+
</li>
|
35
|
+
<% end %>
|
36
|
+
</ul>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</li>
|
40
|
+
<% else %>
|
41
|
+
<!-- Menu normale senza children -->
|
42
|
+
<li class="nav-item border-bottom py-2">
|
43
|
+
<%= link_to path, link_to_options do %>
|
44
|
+
<%= yield %>
|
13
45
|
|
14
|
-
|
15
|
-
|
46
|
+
<% if external %>
|
47
|
+
<i class="bi bi-arrow-up-right position-absolute end-0 top-50 translate-middle-y me-2" style="font-size: 0.75rem"></i>
|
48
|
+
<% end %>
|
16
49
|
<% end %>
|
17
|
-
|
18
|
-
|
50
|
+
</li>
|
51
|
+
<% end %>
|
data/lib/lato/version.rb
CHANGED