From df0d81e322a1340bcb57770476d0e05b1318efde Mon Sep 17 00:00:00 2001
From: shibao
Date: Sat, 30 Jul 2022 16:20:32 -0400
Subject: [PATCH] add instance info
---
lib/memex_web/live/home_live.ex | 4 ++-
lib/memex_web/live/home_live.html.heex | 41 ++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/lib/memex_web/live/home_live.ex b/lib/memex_web/live/home_live.ex
index c2d5b2b..f58796e 100644
--- a/lib/memex_web/live/home_live.ex
+++ b/lib/memex_web/live/home_live.ex
@@ -4,10 +4,12 @@ defmodule MemexWeb.HomeLive do
"""
use MemexWeb, :live_view
+ alias Memex.Accounts
@impl true
def mount(_params, _session, socket) do
- {:ok, socket |> assign(page_title: gettext("Home"), query: "", results: %{})}
+ admins = Accounts.list_users_by_role(:admin)
+ {:ok, socket |> assign(page_title: gettext("Home"), query: "", results: %{}, admins: admins)}
end
@impl true
diff --git a/lib/memex_web/live/home_live.html.heex b/lib/memex_web/live/home_live.html.heex
index c46692a..8e1f6e9 100644
--- a/lib/memex_web/live/home_live.html.heex
+++ b/lib/memex_web/live/home_live.html.heex
@@ -74,4 +74,45 @@
+
+
+
+ <%= gettext("Instance Information") %>
+
+
+ -
+
+ <%= gettext("Admins:") %>
+
+
+ <%= if @admins |> Enum.empty?() do %>
+ <%= link(dgettext("prompts", "Register to setup %{name}", name: "Cannery"),
+ class: "hover:underline",
+ to: Routes.user_registration_path(CanneryWeb.Endpoint, :new)
+ ) %>
+ <% else %>
+
+ <% end %>
+
+
+
+ -
+ Registration:
+
+ <%= Application.get_env(:cannery, CanneryWeb.Endpoint)[:registration]
+ |> case do
+ "public" -> gettext("Public Signups")
+ _ -> gettext("Invite Only")
+ end %>
+
+
+