add proper hcard to homepage

This commit is contained in:
Inhji 2023-07-06 21:28:49 +02:00
parent 79fc09b839
commit 0f4f4940d0
4 changed files with 19 additions and 2 deletions

View file

@ -68,6 +68,8 @@ defmodule Chiya.Accounts do
""" """
def get_user!(id), do: Repo.get!(User, id) def get_user!(id), do: Repo.get!(User, id)
def get_user(id), do: Repo.get(User, id)
## User registration ## User registration
@doc """ @doc """

View file

@ -110,10 +110,14 @@
<p class="mt-4 max-w-2xl mx-auto text-center"> <p class="mt-4 max-w-2xl mx-auto text-center">
Struggling to make a decent website since 2011 Struggling to make a decent website since 2011
</p> </p>
<a href="/about" class="hidden | h-card" rel="me">Inhji</a>
</footer> </footer>
<section class="hidden | hcard h-card">
<a href="/" rel="me"><%= @profile.name %></a>
<img class="u-photo" src={ChiyaWeb.Uploaders.UserImage.url({@profile.user_image, @profile}, :thumb)} />
<a href="acct:inhji@inhji.de" class="u-url" />
</section>
<section class="flex h-1 w-full flex-row"> <section class="flex h-1 w-full flex-row">
<div class="bg-theme-primary w-full"></div> <div class="bg-theme-primary w-full"></div>
<div class="bg-theme-secondary w-full"></div> <div class="bg-theme-secondary w-full"></div>

View file

@ -4,6 +4,16 @@ defmodule ChiyaWeb.GlobalAssigns do
@token_endpoint Application.compile_env!(:chiya, [:indie, :token_endpoint]) @token_endpoint Application.compile_env!(:chiya, [:indie, :token_endpoint])
@auth_endpoint Application.compile_env!(:chiya, [:indie, :auth_endpoint]) @auth_endpoint Application.compile_env!(:chiya, [:indie, :auth_endpoint])
def fetch_profile(conn, _opts) do
user = Chiya.Accounts.get_user(1)
if user do
assign(conn, :profile, user)
else
conn
end
end
def fetch_settings(conn, _opts) do def fetch_settings(conn, _opts) do
settings = Chiya.Site.get_settings() settings = Chiya.Site.get_settings()

View file

@ -19,6 +19,7 @@ defmodule ChiyaWeb.Router do
plug :put_root_layout, {ChiyaWeb.Layouts, :root_public} plug :put_root_layout, {ChiyaWeb.Layouts, :root_public}
plug :fetch_identities plug :fetch_identities
plug :fetch_public_channels plug :fetch_public_channels
plug :fetch_profile
end end
pipeline :api do pipeline :api do