diff options
author | David O'Regan <doregan@gitlab.com> | 2021-03-24 20:15:08 +0300 |
---|---|---|
committer | Suzanne Selhorn <sselhorn@gitlab.com> | 2021-03-24 20:15:08 +0300 |
commit | fde9952a8ebb75227d1879b3999203dca672a26f (patch) | |
tree | e73a871e26ba09b25267e1eb58f66ae944e480f4 /layouts/global_nav.html | |
parent | 89883be9e9cfad350b3959b281583ae8728e4da2 (diff) |
Feat: Update left navigation to allow more levels
Diffstat (limited to 'layouts/global_nav.html')
-rw-r--r-- | layouts/global_nav.html | 71 |
1 files changed, 57 insertions, 14 deletions
diff --git a/layouts/global_nav.html b/layouts/global_nav.html index 6e94d93e..d98fbb96 100644 --- a/layouts/global_nav.html +++ b/layouts/global_nav.html @@ -17,36 +17,79 @@ <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"> - <%= cat.title %> - </a> - <% else %> - <a class="global-nav-link level-1 <%= cat.has_children? ? 'has-collapse' : '' %> <%= navigation.show_element?(cat) ? 'active' : '' %>" href="<%= navigation.element_href(cat) %>"> - <%= cat.title %> - <%= navigation.optional_ee_badge(cat) %> - </a> - <% end %><!-- end of if cat[:external_url] --> + <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"> + <%= cat.title %> + </a> + <% else %> + <a class="global-nav-link level-1 <%= cat.has_children? ? 'has-collapse' : '' %> <%= navigation.show_element?(cat) ? 'active' : '' %>" href="<%= navigation.element_href(cat) %>"> + <%= cat.title %> + <%= 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="#cat_<%= cat_uuid %>"></div> - </span> + </span> <!-- nav docs --> <% if cat.has_children? %> <div class="collapse <%= navigation.show_element?(cat) ? 'show' : '' %>" id="cat_<%= cat_uuid %>"> <% cat.children.each do |doc| %> + <% doc_uuid = SecureRandom.uuid %> <span class="nav-link"> <% if doc.external_url %> - <a class="global-nav-link level-2" href="<%= doc.url %>" target="_blank"> + <a class="global-nav-link level-2 <%= doc.has_children? ? 'has-collapse' : '' %>" href="<%= doc.url %>" target="_blank"> <%= doc.title %> </a> <% else%> - <a class="global-nav-link level-2 <%= navigation.show_element?(doc) ? 'active' : '' %>" href="<%= navigation.element_href(doc) %>"> + <a class="global-nav-link level-2 <%= doc.has_children? ? 'has-collapse' : '' %> <%= navigation.show_element?(doc) ? 'active' : '' %>" href="<%= navigation.element_href(doc) %>"> <%= doc.title %> <%= navigation.optional_ee_badge(doc) %> </a> <% end %><!-- end of if doc[:external_url] --> + <div class="<%= doc.has_children? ? 'collapse-toggle' : '' %> <%= navigation.show_element?(doc) ? 'active' : 'collapsed' %>" data-toggle="collapse" aria-expanded="false" data-target="#doc_<%= doc_uuid %>"></div> </span> + + <!-- nav docs --> + <% if doc.has_children? %> + <div class="collapse <%= navigation.show_element?(doc) ? 'show' : '' %>" id="doc_<%= doc_uuid %>"> + <% doc.children.each do |doc| %> + <% doc_uuid = SecureRandom.uuid %> + <span class="nav-link"> + <% if doc.external_url %> + <a class="global-nav-link level-3 <%= doc.has_children? ? 'has-collapse' : '' %>" href="<%= doc.url %>" target="_blank"> + <%= doc.title %> + </a> + <% else%> + <a class="global-nav-link level-3 <%= doc.has_children? ? 'has-collapse' : '' %> <%= navigation.show_element?(doc) ? 'active' : '' %>" href="<%= navigation.element_href(doc) %>"> + <%= doc.title %> + <%= navigation.optional_ee_badge(doc) %> + </a> + <% end %><!-- end of if doc[:external_url] --> + <div class="<%= doc.has_children? ? 'collapse-toggle' : '' %> <%= navigation.show_element?(doc) ? 'active' : 'collapsed' %>" data-toggle="collapse" aria-expanded="false" data-target="#doc_<%= doc_uuid %>"></div> + </span> + + <!-- nav docs --> + <% if doc.has_children? %> + <div class="collapse <%= navigation.show_element?(doc) ? 'show' : '' %>" id="doc_<%= doc_uuid %>"> + <% doc.children.each do |doc| %> + <span class="nav-link"> + <% if doc.external_url %> + <a class="global-nav-link level-4" href="<%= doc.url %>" target="_blank"> + <%= doc.title %> + </a> + <% else%> + <a class="global-nav-link level-4 <%= navigation.show_element?(doc) ? 'active' : '' %>" href="<%= navigation.element_href(doc) %>"> + <%= doc.title %> + <%= navigation.optional_ee_badge(doc) %> + </a> + <% end %><!-- end of if doc[:external_url] --> + </span> + <% end %><!-- end of cat[:docs] --> + </div> + <% end %><!-- end of if cat[:docs].nil? --> + <% end %><!-- end of doc[:docs] --> + <% end %><!-- end of doc[:docs] --> <% end %><!-- end of cat[:docs] --> </div> <% end %><!-- end of if cat[:docs].nil? --> |