mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-26 13:31:02 +00:00
70af57c6e1
All the template are now compiled at compile-time with the `ructe` crate. I preferred to use it instead of askama because it allows more complex Rust expressions, where askama only supports a small subset of expressions and doesn't allow them everywhere (for instance, `{{ macro!() | filter }}` would result in a parsing error). The diff is quite huge, but there is normally no changes in functionality. Fixes #161 and unblocks #110 and #273
43 lines
1.3 KiB
HTML
43 lines
1.3 KiB
HTML
@use template_utils::*;
|
|
@use plume_models::users::User;
|
|
|
|
@(ctx: BaseContext, user: &User, follows: bool, is_remote: bool, instance_url: String)
|
|
|
|
<div class="user">
|
|
<div class="flex wrap">
|
|
@avatar(ctx.0, &user, Size::Medium, false, ctx.1)
|
|
|
|
<h1 class="grow flex vertical">
|
|
@user.name(ctx.0)
|
|
<small>@user.get_fqn(ctx.0)</small>
|
|
</h1>
|
|
|
|
<p>
|
|
@if user.is_admin {
|
|
<span class="badge">@i18n!(ctx.1, "Admin")</span>
|
|
}
|
|
|
|
@if ctx.2.clone().map(|u| u.id == user.id).unwrap_or(false) {
|
|
<span class="badge">@i18n!(ctx.1, "It is you")</span>
|
|
<a href="/@@/@user.username/edit" class="button inline-block">@i18n!(ctx.1, "Edit your profile")</a>
|
|
}
|
|
</p>
|
|
</div>
|
|
|
|
@if is_remote {
|
|
<a class="inline-block" href="@user.ap_url" target="_blank">@i18n!(ctx.1, "Open on {0}"; instance_url)</a>
|
|
}
|
|
|
|
@if ctx.2.clone().map(|u| u.id != user.id).unwrap_or(false) {
|
|
<form class="inline" method="post" action="/@@/@user.get_fqn(ctx.0)/follow/">
|
|
@if follows {
|
|
<input type="submit" value="@i18n!(ctx.1, "Unfollow")">
|
|
} else {
|
|
<input type="submit" value="@i18n!(ctx.1, "Follow")">
|
|
}
|
|
</form>
|
|
}
|
|
</div>
|
|
<div class="user-summary">
|
|
@Html(user.summary.clone())
|
|
</div>
|