add instance info

This commit is contained in:
shibao 2022-07-30 16:20:32 -04:00
parent 6858df2ae2
commit df0d81e322
2 changed files with 44 additions and 1 deletions

View File

@ -4,10 +4,12 @@ defmodule MemexWeb.HomeLive do
""" """
use MemexWeb, :live_view use MemexWeb, :live_view
alias Memex.Accounts
@impl true @impl true
def mount(_params, _session, socket) do 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 end
@impl true @impl true

View File

@ -74,4 +74,45 @@
</p> </p>
</li> </li>
</ul> </ul>
<hr class="hr" />
<ul class="flex flex-col space-y-4 text-center">
<h2 class="title text-primary-400 text-lg">
<%= gettext("Instance Information") %>
</h2>
<li class="flex flex-col justify-center space-x-2">
<b>
<%= gettext("Admins:") %>
</b>
<p>
<%= 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 %>
<div class="flex flex-wrap justify-center space-x-2">
<%= for admin <- @admins do %>
<a class="hover:underline" href={"mailto:#{admin.email}"}>
<%= admin.email %>
</a>
<% end %>
</div>
<% end %>
</p>
</li>
<li class="flex flex-row justify-center space-x-2">
<b>Registration:</b>
<p>
<%= Application.get_env(:cannery, CanneryWeb.Endpoint)[:registration]
|> case do
"public" -> gettext("Public Signups")
_ -> gettext("Invite Only")
end %>
</p>
</li>
</ul>
</div> </div>