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, writer,
.{ .{
._page = templ, ._page = templ,
.@"mini-user" = @embedFile("./controllers/web/_components/mini-user.tmpl.html"),
}, },
@embedFile("./controllers/web/_format.tmpl.html"), @embedFile("./controllers/web/_format.tmpl.html"),
data, 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| =} {#if .invite |$invite| =}
<div> <div>
<div>You are about to accept an invite from:</div> <div>You are about to accept an invite from:</div>
<div class="user-mini"> {#template mini-user $invite.creator}
<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>
{#if @isTag($invite.kind, community_owner) =} {#if @isTag($invite.kind, community_owner) =}
<div>This act will make your new account the owner of { %community.name }.</div> <div>This act will make your new account the owner of { %community.name }.</div>
{/if =} {/if =}