use live_redirect for topbar links
This commit is contained in:
parent
b86667da98
commit
f55f113622
@ -16,11 +16,10 @@ defmodule CanneryWeb.Components.Topbar do
|
|||||||
<nav role="navigation" class="mb-8 px-8 py-4 w-full bg-primary-400">
|
<nav role="navigation" class="mb-8 px-8 py-4 w-full bg-primary-400">
|
||||||
<div class="flex flex-col sm:flex-row justify-between items-center">
|
<div class="flex flex-col sm:flex-row justify-between items-center">
|
||||||
<div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2">
|
<div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2">
|
||||||
<%= link to: Routes.live_path(Endpoint, HomeLive) do %>
|
<%= live_redirect("Cannery",
|
||||||
<h1 class="mx-2 my-1 leading-5 text-xl text-white hover:underline">
|
to: Routes.live_path(Endpoint, HomeLive),
|
||||||
Cannery
|
class: "mx-2 my-1 leading-5 text-xl text-white hover:underline"
|
||||||
</h1>
|
) %>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= if @title_content do %>
|
<%= if @title_content do %>
|
||||||
<span class="mx-2 my-1">
|
<span class="mx-2 my-1">
|
||||||
@ -38,47 +37,47 @@ defmodule CanneryWeb.Components.Topbar do
|
|||||||
>
|
>
|
||||||
<%= if @current_user do %>
|
<%= if @current_user do %>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(gettext("Tags"),
|
<%= live_redirect(gettext("Tags"),
|
||||||
class: "hover:underline",
|
to: Routes.tag_index_path(Endpoint, :index),
|
||||||
to: Routes.tag_index_path(Endpoint, :index)
|
class: "text-primary-600 text-white hover:underline"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(gettext("Containers"),
|
<%= live_redirect(gettext("Containers"),
|
||||||
class: "hover:underline",
|
to: Routes.container_index_path(Endpoint, :index),
|
||||||
to: Routes.container_index_path(Endpoint, :index)
|
class: "text-primary-600 text-white hover:underline"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(gettext("Ammo"),
|
<%= live_redirect(gettext("Ammo"),
|
||||||
class: "hover:underline",
|
to: Routes.ammo_type_index_path(Endpoint, :index),
|
||||||
to: Routes.ammo_type_index_path(Endpoint, :index)
|
class: "text-primary-600 text-white hover:underline"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(gettext("Manage"),
|
<%= live_redirect(gettext("Manage"),
|
||||||
class: "hover:underline",
|
to: Routes.ammo_group_index_path(Endpoint, :index),
|
||||||
to: Routes.ammo_group_index_path(Endpoint, :index)
|
class: "text-primary-600 text-white hover:underline"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(gettext("Range"),
|
<%= live_redirect(gettext("Range"),
|
||||||
class: "hover:underline",
|
to: Routes.range_index_path(Endpoint, :index),
|
||||||
to: Routes.range_index_path(Endpoint, :index)
|
class: "text-primary-600 text-white hover:underline"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<%= if @current_user.role == :admin do %>
|
<%= if @current_user.role == :admin do %>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(gettext("Invites"),
|
<%= live_redirect(gettext("Invites"),
|
||||||
class: "hover:underline",
|
to: Routes.invite_index_path(Endpoint, :index),
|
||||||
to: Routes.invite_index_path(Endpoint, :index)
|
class: "text-primary-600 text-white hover:underline"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(@current_user.email,
|
<%= live_redirect(@current_user.email,
|
||||||
class: "hover:underline truncate",
|
to: Routes.user_settings_path(Endpoint, :edit),
|
||||||
to: Routes.user_settings_path(Endpoint, :edit)
|
class: "text-primary-600 text-white hover:underline truncate"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
@ -90,7 +89,8 @@ defmodule CanneryWeb.Components.Topbar do
|
|||||||
</li>
|
</li>
|
||||||
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
|
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link to: Routes.live_dashboard_path(Endpoint, :home) do %>
|
<%= live_redirect to: Routes.live_dashboard_path(Endpoint, :home),
|
||||||
|
class: "text-primary-600 text-white hover:underline" do %>
|
||||||
<i class="fas fa-tachometer-alt"></i>
|
<i class="fas fa-tachometer-alt"></i>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
@ -98,16 +98,16 @@ defmodule CanneryWeb.Components.Topbar do
|
|||||||
<% else %>
|
<% else %>
|
||||||
<%= if Accounts.allow_registration?() do %>
|
<%= if Accounts.allow_registration?() do %>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(dgettext("actions", "Register"),
|
<%= live_redirect(dgettext("actions", "Register"),
|
||||||
class: "hover:underline",
|
to: Routes.user_registration_path(Endpoint, :new),
|
||||||
to: Routes.user_registration_path(Endpoint, :new)
|
class: "text-primary-600 text-white hover:underline truncate"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<%= link(dgettext("actions", "Log in"),
|
<%= live_redirect(dgettext("actions", "Log in"),
|
||||||
class: "hover:underline",
|
to: Routes.user_session_path(Endpoint, :new),
|
||||||
to: Routes.user_session_path(Endpoint, :new)
|
class: "text-primary-600 text-white hover:underline truncate"
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
Loading…
Reference in New Issue
Block a user