80a4dae8bd
- Use `Result` as much as possible - Display errors instead of panicking TODO (maybe in another PR? this one is already quite big): - Find a way to merge Ructe/ErrorPage types, so that we can have routes returning `Result<X, ErrorPage>` instead of panicking when we have an `Error` - Display more details about the error, to make it easier to debug (sorry, this isn't going to be fun to review, the diff is huge, but it is always the same changes)
34 lines
1.3 KiB
HTML
34 lines
1.3 KiB
HTML
@use templates::base;
|
|
@use template_utils::*;
|
|
@use plume_models::notifications::Notification;
|
|
|
|
@(ctx: BaseContext, notifications: Vec<Notification>, page: i32, n_pages: i32)
|
|
|
|
@:base(ctx, "Notifications", {}, {}, {
|
|
<h1>@i18n!(ctx.1, "Notifications")</h1>
|
|
|
|
<div class="list">
|
|
@for notification in notifications {
|
|
<div class="card flex">
|
|
<i class="icon @notification.icon_class() left-icon"></i>
|
|
<main class="grow">
|
|
<h3>
|
|
@if let Some(url) = notification.get_url(ctx.0) {
|
|
<a href="@url">
|
|
@i18n!(ctx.1, notification.get_message(); notification.get_actor(ctx.0).unwrap().name(ctx.0))
|
|
</a>
|
|
} else {
|
|
@i18n!(ctx.1, notification.get_message(); notification.get_actor(ctx.0).unwrap().name(ctx.0))
|
|
}
|
|
</h3>
|
|
@if let Some(post) = notification.get_post(ctx.0) {
|
|
<p><a href="@post.url(ctx.0).unwrap_or_default()">@post.title</a></p>
|
|
}
|
|
</main>
|
|
<p><small>@notification.creation_date.format("%B %e, %H:%M")</small></p>
|
|
</div>
|
|
}
|
|
</div>
|
|
@paginate(ctx.1, page, n_pages)
|
|
})
|