Websites/app/views/yiff_rest/apikeys/_nav.html.erb
2024-05-02 22:04:43 -05:00

53 lines
2.5 KiB
Plaintext

<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">
<%= image_tag("#{assets_path}/Blep.png", width: "30", height: "30", class: "rounded-4") %>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<%= link_to "Home", yiff_rest_apikeys_path, class: "nav-link#{if_active(' active', path: yiff_rest_apikeys_path)}" %>
</li>
<li class="nav-item">
<a class="nav-link" href="https://docs.yiff.rest">Documentation</a>
</li>
<li class="nav-item">
<%= link_to "Create API Key", new_yiff_rest_apikey_path, class: "nav-link#{if_active(' active', path: new_yiff_rest_apikey_path)}" %>
</li>
<% if CurrentUser.is_manager? && params[:action] == "index" %>
<% if params.fetch(:search, {})[:owner_id].blank? %>
<li class="nav-item">
<%= link_to "Owned", yiff_rest_apikeys_path(params: with_params(search: { owner_id: CurrentUser.id })), class: "nav-link" %>
</li>
<% else %>
<li class="nav-item">
<%= link_to "All", yiff_rest_apikeys_path(params: without_search(:owner_id)), class: "nav-link" %>
</li>
<% end %>
<% end %>
</ul>
<div class="d-flex">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<%= CurrentUser.name %>
<% if CurrentUser.is_manager? %>
(<%= CurrentUser.level_name %>)
<% end %>
</a>
<ul class="dropdown-menu dropdown-menu-dark">
<li><%= link_to "Log Out", logout_yiff_rest_apikeys_path, class: "dropdown-item" %></li>
</ul>
</li>
</ul>
<% if CurrentUser.avatar.attached? %>
<%= image_tag(CurrentUser.avatar, width: 30, height: 30, class: "rounded-4", alt: "Discord User Icon") %>
<% end %>
</div>
</div>
</div>
</nav>