Plume/templates/users/header.rs.html
fdb-hiroshima 0d708e1639 Add support for remote interact (#519)
Add support for remote interaction ([this thing](https://eldritch.cafe/users/Barmaid/remote_follow) in mastodon)

- [x] create the endpoint dispatching remote interactions to local pages
- [x] add this endpoint to web-finger
- [x] propose remote interaction when following and not connected
- [x] propose remote interaction when liking/sharing and not connected
- [x] propose remote interaction when commenting and not connected
- [x] fetch posts/comments we don't know but remote interaction was requested for ?
2019-04-17 21:09:07 +01:00

48 lines
1.7 KiB
HTML

@use template_utils::*;
@use plume_models::users::User;
@use routes::*;
@(ctx: BaseContext, user: &User, follows: bool, is_remote: bool, instance_url: String)
<div class="h-card">
<div class="user">
<div class="flex wrap">
@avatar(ctx.0, &user, Size::Medium, false, ctx.1)
<h1 class="grow flex vertical">
<span class="p-name">@user.name()</span>
<small class="p-nickname">@user.fqn</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="@uri!(user::edit: name = &user.username)" class="button inline-block">@i18n!(ctx.1, "Edit your profile")</a>
}
</p>
</div>
@if is_remote {
<a class="inline-block u-url" href="@user.ap_url" rel="me" target="_blank">@i18n!(ctx.1, "Open on {0}"; instance_url)</a>
} else {
<a class="u-url" href="@user.ap_url"></a>
}
@if ctx.2.clone().map(|u| u.id != user.id).unwrap_or(true) {
<form class="inline" method="post" action="@uri!(user::follow: name = &user.fqn)">
@if follows {
<input type="submit" value="@i18n!(ctx.1, "Unsubscribe")">
} else {
<input type="submit" value="@i18n!(ctx.1, "Subscribe")">
}
</form>
}
</div>
<div class="user-summary p-note">
@Html(user.summary_html.clone())
</div>
</div>