2020-07-16 22:12:22 +04:00
@use super::base;
2019-07-02 13:37:47 +04:00
@use crate::models::{Photo, Person, Place, Tag, Camera, Coord, SizeTag};
@use crate::server::{Context, Link};
2016-09-23 23:03:04 +03:00
2018-09-01 16:41:40 +04:00
@(context: & Context, lpath: & [Link], people: & [Person], places: & [Place], tags: & [Tag], position: & Option< Coord > , attribution: & Option< String > , camera: & Option< Camera > , photo: & Photo)
2020-07-16 22:12:22 +04:00
@:base(context, "Photo details", lpath, {
2018-11-03 20:17:09 +04:00
< meta property = 'og:title' content = 'Photo @if let Some(d) = photo.date {(@d.format("%F"))}' >
< meta property = 'og:type' content = 'image' / >
< meta property = 'og:image' content = '/img/@photo.id-m.jpg' / >
2019-02-23 23:48:17 +04:00
< meta property = 'og:description' content = '@for p in people {@p.person_name, }@for t in tags {#@t.tag_name, }@if let Some(p) = places.first() {@p.place_name}' >
2018-11-03 20:17:09 +04:00
}, {
2020-07-16 22:12:22 +04:00
< main class = "details" data-imgid = "@photo.id" @ if let Some ( g ) = photo . grade { data-grade = "@g" } @ if let Some ( ref p ) = * position { data-position = "[@p.x, @p.y]" } >
< h1 > Photo details< / h1 >
< img class = "item" src = "/img/@photo.id-m.jpg" width = "@photo.get_size(SizeTag::Medium).0" height = "@photo.get_size(SizeTag::Medium).1" >
2017-02-03 22:44:13 +04:00
< div class = "meta" >
2018-09-01 16:41:40 +04:00
@if context.is_authorized() {
2017-07-30 19:51:19 +04:00
< p > < a href = "/img/@photo.id-l.jpg" > @photo.path< / a > < / p >
@if photo.is_public() {< p > This photo is public.< / p > }
else {< p > This photo is not public.< / p > }
}
2017-07-30 21:47:54 +04:00
@if let Some(g) = photo.grade {< p > Grade: @g< / p > }
@if let Some(d) = photo.date {< p > Time: @d.format("%F %T")< / p > }
2017-02-03 22:44:13 +04:00
@if !people.is_empty() {
2019-02-23 23:48:17 +04:00
< p > People: @for p in people {< a href = "/person/@p.slug" > @p.person_name< / a > , }< / p > }
2017-02-03 22:44:13 +04:00
@if !tags.is_empty() {
2019-02-23 23:48:17 +04:00
< p > Tags: @for t in tags {< a href = "/tag/@t.slug" > @t.tag_name< / a > , }< / p > }
2018-09-07 23:09:51 +04:00
@if !places.is_empty() {
2019-02-23 23:48:17 +04:00
< p class = "places" > Places: @for p in places {< a href = "/place/@p.slug" > @p.place_name< / a > , }< / p > }
2017-12-31 00:17:29 +04:00
@if let Some(ref pos) = *position {< p > Position: @pos.x @pos.y< / p > }
@if let Some(ref a) = *attribution {< p > Av: @a< / p > }
2019-02-23 23:48:17 +04:00
@if let Some(ref c) = *camera {< p > Camera: @c.model (@c.manufacturer)< / p > }
2017-02-03 22:44:13 +04:00
< / div >
2020-07-16 22:12:22 +04:00
< / main >
2016-09-26 01:45:13 +03:00
})