cannery/lib/cannery_web/live/component/topbar.html.leex

108 lines
3.7 KiB
Plaintext
Raw Normal View History

2021-09-02 23:31:15 -04:00
<header class="mb-8 px-8 py-4 w-full bg-primary-400">
<nav role="navigation">
<div class="flex flex-row justify-between items-center space-x-4">
<div class="flex flex-row justify-start items-center space-x-2">
2021-09-10 00:28:53 -04:00
<%= link to: Routes.home_path(CanneryWeb.Endpoint, :index) do %>
2021-09-02 23:31:15 -04:00
<h1 class="leading-5 text-xl text-white hover:underline">Cannery</h1>
<% end %>
2021-09-10 00:30:33 -04:00
2021-09-02 23:31:15 -04:00
<%= if @title_content do %>
<span>|</span>
<%= @title_content %>
<% end %>
</div>
2021-09-10 00:30:33 -04:00
2021-09-02 23:31:15 -04:00
<ul class="flex flex-row flex-wrap justify-center items-center
2021-09-10 21:42:05 -04:00
space-x-4 text-lg text-white">
2021-09-02 23:31:15 -04:00
<%# user settings %>
<%= if @current_user do %>
<li>
<%= link "Tags", class: "hover:underline",
to: Routes.tag_index_path(CanneryWeb.Endpoint, :index) %>
</li>
<li>
<%= link "Containers", class: "hover:underline",
to: Routes.container_index_path(CanneryWeb.Endpoint, :index) %>
</li>
<li>
<%= link "Ammo", class: "hover:underline",
to: Routes.ammo_type_index_path(CanneryWeb.Endpoint, :index) %>
</li>
<li>
<%= link "Manage", class: "hover:underline",
to: Routes.ammo_group_index_path(CanneryWeb.Endpoint, :index) %>
</li>
2021-09-10 00:30:33 -04:00
<%= if @current_user.role == :admin do %>
<li>
<%= link "Invites", class: "hover:underline",
to: Routes.invite_index_path(CanneryWeb.Endpoint, :index) %>
</li>
<% end %>
2021-09-02 23:31:15 -04:00
<%# search %>
2021-09-10 21:42:05 -04:00
<%#
<form phx-change="suggest" phx-submit="search" phx-target="<%= @myself %#>">
2021-09-02 23:31:15 -04:00
<input type="text" name="q" class="input input-primary"
placeholder="Search" list="results" autocomplete="off"/>
<datalist id="results">
2021-09-10 21:42:05 -04:00
<%= for {app, _vsn} <- @results do %#>
<option value="<%= app %#>"><%= app %#></option>
<% end %#>
2021-09-02 23:31:15 -04:00
</datalist>
</form>
2021-09-10 21:42:05 -04:00
%>
2021-09-10 00:30:33 -04:00
2021-09-02 23:31:15 -04:00
<li>
<%= link @current_user.email, class: "hover:underline",
to: Routes.user_settings_path(CanneryWeb.Endpoint, :edit) %>
</li>
2021-09-02 23:31:15 -04:00
<li>
<%= link to: Routes.user_session_path(CanneryWeb.Endpoint, :delete), method: :delete,
data: [confirm: "Are you sure you want to log out?"] do %>
2021-09-02 23:31:15 -04:00
<i class="fas fa-sign-out-alt"></i>
<% end %>
</li>
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
2021-09-02 23:31:15 -04:00
<li>
2021-09-03 19:54:05 -04:00
<%= link to: Routes.live_dashboard_path(CanneryWeb.Endpoint, :home) do %>
<i class="fas fa-tachometer-alt"></i>
<% end %>
2021-09-02 23:31:15 -04:00
</li>
<% end %>
2021-09-02 23:31:15 -04:00
<% else %>
<%= if Accounts.allow_registration?() do %>
2021-09-10 00:30:33 -04:00
<li>
<%= link "Register", class: "hover:underline",
to: Routes.user_registration_path(CanneryWeb.Endpoint, :new) %>
</li>
<% end %>
2021-09-02 23:31:15 -04:00
<li>
<%= link "Log in", class: "hover:underline",
to: Routes.user_session_path(CanneryWeb.Endpoint, :new) %>
</li>
<% end %>
</ul>
</div>
</nav>
<%= if live_flash(@flash, :info) do %>
<p class="alert alert-info" role="alert"
phx-click="lv:clear-flash" phx-value-key="info">
<%= live_flash(@flash, :info) %>
</p>
<% end %>
<%= if live_flash(@flash, :error) do %>
<p class="alert alert-danger" role="alert"
phx-click="lv:clear-flash" phx-value-key="error">
<%= live_flash(@flash, :error) %>
</p>
<% end %>
2021-09-10 00:30:33 -04:00
</header>