Plume/templates/medias/details.rs.html

41 lines
1.4 KiB
HTML
Raw Normal View History

@use plume_models::medias::{Media, MediaCategory};
@use plume_models::safe_string::SafeString;
2020-01-21 06:02:03 +00:00
@use crate::templates::base;
@use crate::template_utils::*;
@use crate::routes::*;
@(ctx: BaseContext, media: Media)
@:base(ctx, i18n!(ctx.1, "Media details"), {}, {}, {
<h1>@i18n!(ctx.1, "Media details")</h1>
<section>
<a href="@uri!(medias::list: page = _)">@i18n!(ctx.1, "Go back to the gallery")</a>
</section>
<section>
<figure class="media">
@Html(media.html().unwrap_or_else(|_| SafeString::new("")))
<figcaption>@media.alt_text</figcaption>
</figure>
<div>
<p>
@i18n!(ctx.1, "Markdown syntax")
<small>@i18n!(ctx.1, "Copy it into your articles, to insert this media:")</small>
</p>
<code>@media.markdown().unwrap_or_else(|_| SafeString::new(""))</code>
</div>
</section>
<section>
@if media.category() == MediaCategory::Image {
<form method="post" action="@uri!(medias::set_avatar: id = media.id)">
<input class="button" type="submit" value="@i18n!(ctx.1, "Use as an avatar")">
</form>
}
<form method="post" action="@uri!(medias::delete: id = media.id)">
<input class="button destructive" type="submit" value="@i18n!(ctx.1, "Delete")">
</form>
</section>
})