use topbar component everywhere
This commit is contained in:
parent
85ea96a171
commit
c000843d40
@ -1,20 +1,20 @@
|
||||
<main role="main" class="container min-h-full min-w-full">
|
||||
<header class="mb-4 px-8 py-4 w-full bg-primary-400">
|
||||
<%= render("topbar.html", assigns) %>
|
||||
</header>
|
||||
<header>
|
||||
<.topbar current_user={assigns[:current_user]}></.topbar>
|
||||
|
||||
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
|
||||
<%= if get_flash(@conn, :info) do %>
|
||||
<p class="alert alert-info" role="alert">
|
||||
<%= get_flash(@conn, :info) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<%= if get_flash(@conn, :error) do %>
|
||||
<p class="alert alert-danger" role="alert">
|
||||
<%= get_flash(@conn, :error) %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
|
||||
<%= if get_flash(@conn, :info) do %>
|
||||
<p class="alert alert-info" role="alert">
|
||||
<%= get_flash(@conn, :info) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<%= if get_flash(@conn, :error) do %>
|
||||
<p class="alert alert-danger" role="alert">
|
||||
<%= get_flash(@conn, :error) %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<%= @inner_content %>
|
||||
</main>
|
||||
|
@ -1,83 +0,0 @@
|
||||
<nav role="navigation">
|
||||
<div class="flex flex-row justify-between items-center space-x-4 overflow-x-hidden">
|
||||
<%= link to: Routes.live_path(Endpoint, HomeLive) do %>
|
||||
<h1 class="leading-5 text-xl text-white hover:underline">
|
||||
Cannery
|
||||
</h1>
|
||||
<% end %>
|
||||
|
||||
<ul class="flex flex-col sm:flex-row flex-wrap justify-center items-center
|
||||
space-x-4 text-lg text-white text-ellipsis">
|
||||
<%= if assigns |> Map.has_key?(:current_user) && @current_user do %>
|
||||
<li>
|
||||
<%= link(gettext("Tags"),
|
||||
class: "hover:underline",
|
||||
to: Routes.tag_index_path(Endpoint, :index)
|
||||
) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link(gettext("Containers"),
|
||||
class: "hover:underline",
|
||||
to: Routes.container_index_path(Endpoint, :index)
|
||||
) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link(gettext("Ammo"),
|
||||
class: "hover:underline",
|
||||
to: Routes.ammo_type_index_path(Endpoint, :index)
|
||||
) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link(gettext("Manage"),
|
||||
class: "hover:underline",
|
||||
to: Routes.ammo_group_index_path(Endpoint, :index)
|
||||
) %>
|
||||
</li>
|
||||
<%= if @current_user.role == :admin do %>
|
||||
<li>
|
||||
<%= link(gettext("Invites"),
|
||||
class: "hover:underline",
|
||||
to: Routes.invite_index_path(Endpoint, :index)
|
||||
) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link(@current_user.email,
|
||||
class: "hover:underline",
|
||||
to: Routes.user_settings_path(Endpoint, :edit)
|
||||
) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link to: Routes.user_session_path(Endpoint, :delete),
|
||||
method: :delete,
|
||||
data: [confirm: dgettext("prompts", "Are you sure you want to log out?")] do %>
|
||||
<i class="fas fa-sign-out-alt"></i>
|
||||
<% end %>
|
||||
</li>
|
||||
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
|
||||
<li>
|
||||
<%= link to: Routes.live_dashboard_path(Endpoint, :home) do %>
|
||||
<i class="fas fa-tachometer-alt"></i>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= if Accounts.allow_registration?() do %>
|
||||
<li>
|
||||
<%= link(dgettext("actions", "Register"),
|
||||
class: "hover:underline",
|
||||
to: Routes.user_registration_path(Endpoint, :new)
|
||||
) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li>
|
||||
<%= link(dgettext("actions", "Log in"),
|
||||
class: "hover:underline",
|
||||
to: Routes.user_session_path(Endpoint, :new)
|
||||
) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
Loading…
Reference in New Issue
Block a user