diff options
author | jerasmus <jerasmus@gitlab.com> | 2020-11-17 14:58:03 +0300 |
---|---|---|
committer | jerasmus <jerasmus@gitlab.com> | 2020-11-17 16:37:25 +0300 |
commit | 652b13ae0932b2a40b064763d88ae6624b93c7cd (patch) | |
tree | 50b75f367e337bff7c9146a5778dec66538c4da8 /layouts/global_nav.html | |
parent | 3e3cacb72cb52cf6554b5a71de26b00aa7364a1e (diff) |
Generate UUID for nav items
Generated a UUID for nav items expand/collapse
Diffstat (limited to 'layouts/global_nav.html')
-rw-r--r-- | layouts/global_nav.html | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/layouts/global_nav.html b/layouts/global_nav.html index f5b587a1..6e94d93e 100644 --- a/layouts/global_nav.html +++ b/layouts/global_nav.html @@ -2,19 +2,21 @@ <nav class="global-nav-content"> <!-- nav sections --> <% navigation.children.each do |sec| %> + <% sec_uuid = SecureRandom.uuid %> <div class="global-nav-section"> <span class="global-nav-block-top nav-link"> <a class="global-nav-link level-0 <%= sec.has_children? ? 'has-collapse' : '' %> <%= navigation.show_element?(sec) ? 'active' : '' %>" href="<%= navigation.element_href(sec) %>"> <%= sec.title %> <%= navigation.optional_ee_badge(sec) %> </a> - <div class="section-title <%= sec.has_children? ? 'collapse-toggle': '' %> <%= navigation.show_element?(sec) ? 'active' : 'collapsed' %>" data-toggle="collapse" aria-expanded="false" data-target="#<%= navigation.id_for(sec) %>"></div> + <div class="section-title <%= sec.has_children? ? 'collapse-toggle': '' %> <%= navigation.show_element?(sec) ? 'active' : 'collapsed' %>" data-toggle="collapse" aria-expanded="false" data-target="#sec_<%= sec_uuid %>"></div> </span> <!-- nav categories --> <% if sec.has_children? && sec.enabled %> - <div class="collapse <%= navigation.show_element?(sec) ? 'show' : '' %>" id="<%= navigation.id_for(sec) %>"> + <div class="collapse <%= navigation.show_element?(sec) ? 'show' : '' %>" id="sec_<%= sec_uuid %>"> <% sec.children.each do |cat| %> + <% cat_uuid = SecureRandom.uuid %> <span class="global-nav-cat nav-link"> <% if cat.external_url %> <a class="global-nav-link level-1 <%= cat.has_children? ? 'has-collapse' : '' %>" href="<%= cat.url %>" target="_blank"> @@ -26,12 +28,12 @@ <%= navigation.optional_ee_badge(cat) %> </a> <% end %><!-- end of if cat[:external_url] --> - <div class="<%= cat.has_children? ? 'collapse-toggle' : '' %> <%= navigation.show_element?(cat) ? 'active' : 'collapsed' %>" data-toggle="collapse" aria-expanded="false" data-target="#<%= navigation.id_for(cat) %>"></div> + <div class="<%= cat.has_children? ? 'collapse-toggle' : '' %> <%= navigation.show_element?(cat) ? 'active' : 'collapsed' %>" data-toggle="collapse" aria-expanded="false" data-target="#cat_<%= cat_uuid %>"></div> </span> <!-- nav docs --> <% if cat.has_children? %> - <div class="collapse <%= navigation.show_element?(cat) ? 'show' : '' %>" id="<%= navigation.id_for(cat) %>"> + <div class="collapse <%= navigation.show_element?(cat) ? 'show' : '' %>" id="cat_<%= cat_uuid %>"> <% cat.children.each do |doc| %> <span class="nav-link"> <% if doc.external_url %> |