Move user-mini display to subtemplate

This commit is contained in:
jaina heartles 2022-12-11 20:23:20 -08:00
parent e617406872
commit 04fdd2ae8e
3 changed files with 15 additions and 13 deletions

View File

@ -231,6 +231,7 @@ pub const Response = struct {
writer,
.{
._page = templ,
.@"mini-user" = @embedFile("./controllers/web/_components/mini-user.tmpl.html"),
},
@embedFile("./controllers/web/_format.tmpl.html"),
data,

View File

@ -0,0 +1,13 @@
<div class="user-mini">
<img class="avatar" src="{.avatar_url}" />
<div class="details">
<div class="display_name">
{=#if .display_name |$name|=}
{$name}
{= #else =}
{.username}
{= /if =}
</div>
<div class="handle">@{.username}@{.host}</div>
</div>
</div>

View File

@ -9,19 +9,7 @@
{#if .invite |$invite| =}
<div>
<div>You are about to accept an invite from:</div>
<div class="user-mini">
<img class="avatar" src="{$invite.creator.avatar_url}" />
<div class="details">
<div class="display_name">
{=#if $invite.creator.display_name |$name|=}
{$name}
{= #else =}
{$invite.creator.username}
{= /if =}
</div>
<div class="handle">@{$invite.creator.username}@{$invite.creator.host}</div>
</div>
</div>
{#template mini-user $invite.creator}
{#if @isTag($invite.kind, community_owner) =}
<div>This act will make your new account the owner of { %community.name }.</div>
{/if =}