forked from shibao/cannery
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">
|
||||
<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">
|
||||
<%= link to: Routes.live_path(Endpoint, HomeLive) do %>
|
||||
<h1 class="mx-2 my-1 leading-5 text-xl text-white hover:underline">
|
||||
Cannery
|
||||
</h1>
|
||||
<% end %>
|
||||
<%= live_redirect("Cannery",
|
||||
to: Routes.live_path(Endpoint, HomeLive),
|
||||
class: "mx-2 my-1 leading-5 text-xl text-white hover:underline"
|
||||
) %>
|
||||
|
||||
<%= if @title_content do %>
|
||||
<span class="mx-2 my-1">
|
||||
@ -38,47 +37,47 @@ defmodule CanneryWeb.Components.Topbar do
|
||||
>
|
||||
<%= if @current_user do %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(gettext("Tags"),
|
||||
class: "hover:underline",
|
||||
to: Routes.tag_index_path(Endpoint, :index)
|
||||
<%= live_redirect(gettext("Tags"),
|
||||
to: Routes.tag_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(gettext("Containers"),
|
||||
class: "hover:underline",
|
||||
to: Routes.container_index_path(Endpoint, :index)
|
||||
<%= live_redirect(gettext("Containers"),
|
||||
to: Routes.container_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(gettext("Ammo"),
|
||||
class: "hover:underline",
|
||||
to: Routes.ammo_type_index_path(Endpoint, :index)
|
||||
<%= live_redirect(gettext("Ammo"),
|
||||
to: Routes.ammo_type_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(gettext("Manage"),
|
||||
class: "hover:underline",
|
||||
to: Routes.ammo_group_index_path(Endpoint, :index)
|
||||
<%= live_redirect(gettext("Manage"),
|
||||
to: Routes.ammo_group_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(gettext("Range"),
|
||||
class: "hover:underline",
|
||||
to: Routes.range_index_path(Endpoint, :index)
|
||||
<%= live_redirect(gettext("Range"),
|
||||
to: Routes.range_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
</li>
|
||||
<%= if @current_user.role == :admin do %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(gettext("Invites"),
|
||||
class: "hover:underline",
|
||||
to: Routes.invite_index_path(Endpoint, :index)
|
||||
<%= live_redirect(gettext("Invites"),
|
||||
to: Routes.invite_index_path(Endpoint, :index),
|
||||
class: "text-primary-600 text-white hover:underline"
|
||||
) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(@current_user.email,
|
||||
class: "hover:underline truncate",
|
||||
to: Routes.user_settings_path(Endpoint, :edit)
|
||||
<%= live_redirect(@current_user.email,
|
||||
to: Routes.user_settings_path(Endpoint, :edit),
|
||||
class: "text-primary-600 text-white hover:underline truncate"
|
||||
) %>
|
||||
</li>
|
||||
<li class="mx-2 my-1">
|
||||
@ -90,7 +89,8 @@ defmodule CanneryWeb.Components.Topbar do
|
||||
</li>
|
||||
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
|
||||
<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>
|
||||
<% end %>
|
||||
</li>
|
||||
@ -98,16 +98,16 @@ defmodule CanneryWeb.Components.Topbar do
|
||||
<% else %>
|
||||
<%= if Accounts.allow_registration?() do %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(dgettext("actions", "Register"),
|
||||
class: "hover:underline",
|
||||
to: Routes.user_registration_path(Endpoint, :new)
|
||||
<%= live_redirect(dgettext("actions", "Register"),
|
||||
to: Routes.user_registration_path(Endpoint, :new),
|
||||
class: "text-primary-600 text-white hover:underline truncate"
|
||||
) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="mx-2 my-1">
|
||||
<%= link(dgettext("actions", "Log in"),
|
||||
class: "hover:underline",
|
||||
to: Routes.user_session_path(Endpoint, :new)
|
||||
<%= live_redirect(dgettext("actions", "Log in"),
|
||||
to: Routes.user_session_path(Endpoint, :new),
|
||||
class: "text-primary-600 text-white hover:underline truncate"
|
||||
) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user