diff --git a/lib/cannery_web/components/topbar.ex b/lib/cannery_web/components/topbar.ex
index 4cfe439a..5ad0ce99 100644
--- a/lib/cannery_web/components/topbar.ex
+++ b/lib/cannery_web/components/topbar.ex
@@ -6,7 +6,7 @@ defmodule CanneryWeb.Components.Topbar do
use CanneryWeb, :component
alias Cannery.Accounts
- alias CanneryWeb.{Endpoint, HomeLive}
+ alias CanneryWeb.HomeLive
def topbar(assigns) do
assigns =
@@ -81,16 +81,14 @@ defmodule CanneryWeb.Components.Topbar do
<%= gettext("Range") %>
- <%= if @current_user.role == :admin do %>
-
- <.link
- navigate={Routes.invite_index_path(Endpoint, :index)}
- class="text-primary-600 text-white hover:underline"
- >
- <%= gettext("Invites") %>
-
-
- <% end %>
+ Accounts.is_already_admin?()} class="mx-2 my-1">
+ <.link
+ navigate={Routes.invite_index_path(Endpoint, :index)}
+ class="text-primary-600 text-white hover:underline"
+ >
+ <%= gettext("Invites") %>
+
+
<.link
href={Routes.user_settings_path(Endpoint, :edit)}
@@ -110,7 +108,8 @@ defmodule CanneryWeb.Components.Topbar do
Accounts.is_already_admin?() and
+ function_exported?(Routes, :live_dashboard_path, 2)
}
class="mx-2 my-1"
>
diff --git a/lib/cannery_web/live/invite_live/index.ex b/lib/cannery_web/live/invite_live/index.ex
index 1f3fdf2f..dbd6b3fd 100644
--- a/lib/cannery_web/live/invite_live/index.ex
+++ b/lib/cannery_web/live/invite_live/index.ex
@@ -7,7 +7,7 @@ defmodule CanneryWeb.InviteLive.Index do
import CanneryWeb.Components.{InviteCard, UserCard}
alias Cannery.Accounts
alias Cannery.Accounts.{Invite, Invites}
- alias CanneryWeb.{Endpoint, HomeLive}
+ alias CanneryWeb.HomeLive
alias Phoenix.LiveView.JS
@impl true
diff --git a/lib/cannery_web/live/tag_live/index.ex b/lib/cannery_web/live/tag_live/index.ex
index f9f8674e..268a51b4 100644
--- a/lib/cannery_web/live/tag_live/index.ex
+++ b/lib/cannery_web/live/tag_live/index.ex
@@ -6,7 +6,7 @@ defmodule CanneryWeb.TagLive.Index do
use CanneryWeb, :live_view
import CanneryWeb.Components.TagCard
alias Cannery.{Tags, Tags.Tag}
- alias CanneryWeb.{Endpoint, ViewHelpers}
+ alias CanneryWeb.ViewHelpers
@impl true
def mount(%{"search" => search}, _session, socket) do
diff --git a/lib/cannery_web/views/email_view.ex b/lib/cannery_web/views/email_view.ex
index 8cb0ebdf..600c5ad9 100644
--- a/lib/cannery_web/views/email_view.ex
+++ b/lib/cannery_web/views/email_view.ex
@@ -3,5 +3,5 @@ defmodule CanneryWeb.EmailView do
A view for email-related helper functions
"""
use CanneryWeb, :view
- alias CanneryWeb.{Endpoint, HomeLive}
+ alias CanneryWeb.HomeLive
end
diff --git a/lib/cannery_web/views/error_view.ex b/lib/cannery_web/views/error_view.ex
index b93bf8d4..377a7294 100644
--- a/lib/cannery_web/views/error_view.ex
+++ b/lib/cannery_web/views/error_view.ex
@@ -1,7 +1,7 @@
defmodule CanneryWeb.ErrorView do
use CanneryWeb, :view
import CanneryWeb.Components.Topbar
- alias CanneryWeb.{Endpoint, HomeLive}
+ alias CanneryWeb.HomeLive
def template_not_found(error_path, _assigns) do
error_string =
diff --git a/lib/cannery_web/views/layout_view.ex b/lib/cannery_web/views/layout_view.ex
index e364c650..29531d19 100644
--- a/lib/cannery_web/views/layout_view.ex
+++ b/lib/cannery_web/views/layout_view.ex
@@ -1,7 +1,7 @@
defmodule CanneryWeb.LayoutView do
use CanneryWeb, :view
import CanneryWeb.Components.Topbar
- alias CanneryWeb.{Endpoint, HomeLive}
+ alias CanneryWeb.HomeLive
# Phoenix LiveDashboard is available only in development by default,
# so we instruct Elixir to not warn if the dashboard route is missing.
diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot
index cf617169..cdca96a4 100644
--- a/priv/gettext/actions.pot
+++ b/priv/gettext/actions.pot
@@ -66,7 +66,7 @@ msgstr ""
msgid "Invite someone new!"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:138
+#: lib/cannery_web/components/topbar.ex:137
#: lib/cannery_web/templates/user_confirmation/new.html.heex:31
#: lib/cannery_web/templates/user_registration/new.html.heex:44
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:45
@@ -97,7 +97,7 @@ msgstr ""
msgid "New Tag"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:130
+#: lib/cannery_web/components/topbar.ex:129
#: lib/cannery_web/templates/user_confirmation/new.html.heex:28
#: lib/cannery_web/templates/user_registration/new.html.heex:3
#: lib/cannery_web/templates/user_registration/new.html.heex:37
diff --git a/priv/gettext/de/LC_MESSAGES/actions.po b/priv/gettext/de/LC_MESSAGES/actions.po
index 239eae69..5008c7b2 100644
--- a/priv/gettext/de/LC_MESSAGES/actions.po
+++ b/priv/gettext/de/LC_MESSAGES/actions.po
@@ -79,7 +79,7 @@ msgstr "Passwort vergessen?"
msgid "Invite someone new!"
msgstr "Laden Sie jemanden ein!"
-#: lib/cannery_web/components/topbar.ex:138
+#: lib/cannery_web/components/topbar.ex:137
#: lib/cannery_web/templates/user_confirmation/new.html.heex:31
#: lib/cannery_web/templates/user_registration/new.html.heex:44
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:45
@@ -110,7 +110,7 @@ msgstr "Neuer Behälter"
msgid "New Tag"
msgstr "Neuer Tag"
-#: lib/cannery_web/components/topbar.ex:130
+#: lib/cannery_web/components/topbar.ex:129
#: lib/cannery_web/templates/user_confirmation/new.html.heex:28
#: lib/cannery_web/templates/user_registration/new.html.heex:3
#: lib/cannery_web/templates/user_registration/new.html.heex:37
diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po
index 827a8990..f528ff15 100644
--- a/priv/gettext/de/LC_MESSAGES/default.po
+++ b/priv/gettext/de/LC_MESSAGES/default.po
@@ -188,7 +188,7 @@ msgstr "Einladung deaktiviert"
msgid "Invite Only"
msgstr "Nur mit Einladung"
-#: lib/cannery_web/components/topbar.ex:90
+#: lib/cannery_web/components/topbar.ex:89
#: lib/cannery_web/live/invite_live/index.ex:42
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po
index cd88c04e..e785c903 100644
--- a/priv/gettext/de/LC_MESSAGES/prompts.po
+++ b/priv/gettext/de/LC_MESSAGES/prompts.po
@@ -84,7 +84,7 @@ msgstr "Sind Sie sicher, dass sie diese Munition löschen möchten?"
msgid "Are you sure you want to delete your account?"
msgstr "Sind Sie sicher, dass sie Ihren Account löschen möchten?"
-#: lib/cannery_web/components/topbar.ex:106
+#: lib/cannery_web/components/topbar.ex:104
#, elixir-autogen, elixir-format
msgid "Are you sure you want to log out?"
msgstr "Wirklich ausloggen?"
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot
index 37466796..2e7d5da6 100644
--- a/priv/gettext/default.pot
+++ b/priv/gettext/default.pot
@@ -184,7 +184,7 @@ msgstr ""
msgid "Invite Only"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:90
+#: lib/cannery_web/components/topbar.ex:89
#: lib/cannery_web/live/invite_live/index.ex:42
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/en/LC_MESSAGES/actions.po b/priv/gettext/en/LC_MESSAGES/actions.po
index d8eb01d6..8aa4362a 100644
--- a/priv/gettext/en/LC_MESSAGES/actions.po
+++ b/priv/gettext/en/LC_MESSAGES/actions.po
@@ -66,7 +66,7 @@ msgstr ""
msgid "Invite someone new!"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:138
+#: lib/cannery_web/components/topbar.ex:137
#: lib/cannery_web/templates/user_confirmation/new.html.heex:31
#: lib/cannery_web/templates/user_registration/new.html.heex:44
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:45
@@ -97,7 +97,7 @@ msgstr ""
msgid "New Tag"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:130
+#: lib/cannery_web/components/topbar.ex:129
#: lib/cannery_web/templates/user_confirmation/new.html.heex:28
#: lib/cannery_web/templates/user_registration/new.html.heex:3
#: lib/cannery_web/templates/user_registration/new.html.heex:37
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
index 3cad647e..c657e18e 100644
--- a/priv/gettext/en/LC_MESSAGES/default.po
+++ b/priv/gettext/en/LC_MESSAGES/default.po
@@ -184,7 +184,7 @@ msgstr ""
msgid "Invite Only"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:90
+#: lib/cannery_web/components/topbar.ex:89
#: lib/cannery_web/live/invite_live/index.ex:42
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po
index 121c66b7..cd96e27c 100644
--- a/priv/gettext/en/LC_MESSAGES/prompts.po
+++ b/priv/gettext/en/LC_MESSAGES/prompts.po
@@ -69,7 +69,7 @@ msgstr ""
msgid "Are you sure you want to delete your account?"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:106
+#: lib/cannery_web/components/topbar.ex:104
#, elixir-autogen, elixir-format
msgid "Are you sure you want to log out?"
msgstr ""
diff --git a/priv/gettext/es/LC_MESSAGES/actions.po b/priv/gettext/es/LC_MESSAGES/actions.po
index cd446ecf..c741b726 100644
--- a/priv/gettext/es/LC_MESSAGES/actions.po
+++ b/priv/gettext/es/LC_MESSAGES/actions.po
@@ -79,7 +79,7 @@ msgstr "¿Has olvidado tu contraseña?"
msgid "Invite someone new!"
msgstr "¡Invita a alguien nuevo!"
-#: lib/cannery_web/components/topbar.ex:138
+#: lib/cannery_web/components/topbar.ex:137
#: lib/cannery_web/templates/user_confirmation/new.html.heex:31
#: lib/cannery_web/templates/user_registration/new.html.heex:44
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:45
@@ -110,7 +110,7 @@ msgstr "Nuevo Contenedor"
msgid "New Tag"
msgstr "Nueva Etiqueta"
-#: lib/cannery_web/components/topbar.ex:130
+#: lib/cannery_web/components/topbar.ex:129
#: lib/cannery_web/templates/user_confirmation/new.html.heex:28
#: lib/cannery_web/templates/user_registration/new.html.heex:3
#: lib/cannery_web/templates/user_registration/new.html.heex:37
diff --git a/priv/gettext/es/LC_MESSAGES/default.po b/priv/gettext/es/LC_MESSAGES/default.po
index fbabae76..b88ec258 100644
--- a/priv/gettext/es/LC_MESSAGES/default.po
+++ b/priv/gettext/es/LC_MESSAGES/default.po
@@ -188,7 +188,7 @@ msgstr "Invitación Desactivada"
msgid "Invite Only"
msgstr "Solo Invitación"
-#: lib/cannery_web/components/topbar.ex:90
+#: lib/cannery_web/components/topbar.ex:89
#: lib/cannery_web/live/invite_live/index.ex:42
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/es/LC_MESSAGES/prompts.po b/priv/gettext/es/LC_MESSAGES/prompts.po
index 5645e41c..aad94478 100644
--- a/priv/gettext/es/LC_MESSAGES/prompts.po
+++ b/priv/gettext/es/LC_MESSAGES/prompts.po
@@ -84,7 +84,7 @@ msgstr "Está seguro que desea eliminar esta munición?"
msgid "Are you sure you want to delete your account?"
msgstr "Está seguro que desea eliminar su cuenta?"
-#: lib/cannery_web/components/topbar.ex:106
+#: lib/cannery_web/components/topbar.ex:104
#, elixir-autogen, elixir-format
msgid "Are you sure you want to log out?"
msgstr "Está seguro que desea cerrar sesión?"
diff --git a/priv/gettext/fr/LC_MESSAGES/actions.po b/priv/gettext/fr/LC_MESSAGES/actions.po
index 6e90e09b..cad76a46 100644
--- a/priv/gettext/fr/LC_MESSAGES/actions.po
+++ b/priv/gettext/fr/LC_MESSAGES/actions.po
@@ -79,7 +79,7 @@ msgstr "Mot de passe oublié ?"
msgid "Invite someone new!"
msgstr "Invitez une nouvelle personne !"
-#: lib/cannery_web/components/topbar.ex:138
+#: lib/cannery_web/components/topbar.ex:137
#: lib/cannery_web/templates/user_confirmation/new.html.heex:31
#: lib/cannery_web/templates/user_registration/new.html.heex:44
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:45
@@ -110,7 +110,7 @@ msgstr "Nouveau conteneur"
msgid "New Tag"
msgstr "Nouveau tag"
-#: lib/cannery_web/components/topbar.ex:130
+#: lib/cannery_web/components/topbar.ex:129
#: lib/cannery_web/templates/user_confirmation/new.html.heex:28
#: lib/cannery_web/templates/user_registration/new.html.heex:3
#: lib/cannery_web/templates/user_registration/new.html.heex:37
diff --git a/priv/gettext/fr/LC_MESSAGES/default.po b/priv/gettext/fr/LC_MESSAGES/default.po
index 9611b272..0a8aa94a 100644
--- a/priv/gettext/fr/LC_MESSAGES/default.po
+++ b/priv/gettext/fr/LC_MESSAGES/default.po
@@ -188,7 +188,7 @@ msgstr "Invitation désactivée"
msgid "Invite Only"
msgstr "Uniquement sur invitation"
-#: lib/cannery_web/components/topbar.ex:90
+#: lib/cannery_web/components/topbar.ex:89
#: lib/cannery_web/live/invite_live/index.ex:42
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/fr/LC_MESSAGES/prompts.po b/priv/gettext/fr/LC_MESSAGES/prompts.po
index 6ca16eca..8a87ee1b 100644
--- a/priv/gettext/fr/LC_MESSAGES/prompts.po
+++ b/priv/gettext/fr/LC_MESSAGES/prompts.po
@@ -85,7 +85,7 @@ msgstr "Êtes-vous certain·e de supprimer cette munition ?"
msgid "Are you sure you want to delete your account?"
msgstr "Êtes-vous certain·e de supprimer votre compte ?"
-#: lib/cannery_web/components/topbar.ex:106
+#: lib/cannery_web/components/topbar.ex:104
#, elixir-autogen, elixir-format
msgid "Are you sure you want to log out?"
msgstr "Êtes-vous certain·e de vouloir vous déconnecter ?"
diff --git a/priv/gettext/ga/LC_MESSAGES/actions.po b/priv/gettext/ga/LC_MESSAGES/actions.po
index ae31283b..81f9513c 100644
--- a/priv/gettext/ga/LC_MESSAGES/actions.po
+++ b/priv/gettext/ga/LC_MESSAGES/actions.po
@@ -77,7 +77,7 @@ msgstr ""
msgid "Invite someone new!"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:138
+#: lib/cannery_web/components/topbar.ex:137
#: lib/cannery_web/templates/user_confirmation/new.html.heex:31
#: lib/cannery_web/templates/user_registration/new.html.heex:44
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:45
@@ -108,7 +108,7 @@ msgstr ""
msgid "New Tag"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:130
+#: lib/cannery_web/components/topbar.ex:129
#: lib/cannery_web/templates/user_confirmation/new.html.heex:28
#: lib/cannery_web/templates/user_registration/new.html.heex:3
#: lib/cannery_web/templates/user_registration/new.html.heex:37
diff --git a/priv/gettext/ga/LC_MESSAGES/default.po b/priv/gettext/ga/LC_MESSAGES/default.po
index ed921687..2584b2b0 100644
--- a/priv/gettext/ga/LC_MESSAGES/default.po
+++ b/priv/gettext/ga/LC_MESSAGES/default.po
@@ -186,7 +186,7 @@ msgstr ""
msgid "Invite Only"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:90
+#: lib/cannery_web/components/topbar.ex:89
#: lib/cannery_web/live/invite_live/index.ex:42
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
diff --git a/priv/gettext/ga/LC_MESSAGES/prompts.po b/priv/gettext/ga/LC_MESSAGES/prompts.po
index cb2b2386..346062df 100644
--- a/priv/gettext/ga/LC_MESSAGES/prompts.po
+++ b/priv/gettext/ga/LC_MESSAGES/prompts.po
@@ -80,7 +80,7 @@ msgstr ""
msgid "Are you sure you want to delete your account?"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:106
+#: lib/cannery_web/components/topbar.ex:104
#, elixir-autogen, elixir-format
msgid "Are you sure you want to log out?"
msgstr ""
diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot
index 9f060294..d4b5b2b6 100644
--- a/priv/gettext/prompts.pot
+++ b/priv/gettext/prompts.pot
@@ -69,7 +69,7 @@ msgstr ""
msgid "Are you sure you want to delete your account?"
msgstr ""
-#: lib/cannery_web/components/topbar.ex:106
+#: lib/cannery_web/components/topbar.ex:104
#, elixir-autogen, elixir-format
msgid "Are you sure you want to log out?"
msgstr ""