2017-08-03 21:59:21 +04:00
|
|
|
@use nickel::Request;
|
|
|
|
@use nickel_jwt_session::SessionRequestExtensions;
|
2017-12-30 20:04:23 +04:00
|
|
|
@use models::{Photo, Person, Place, Tag, Camera, Coord};
|
2018-03-03 17:39:33 +04:00
|
|
|
@use server::Link;
|
2016-09-26 01:45:13 +03:00
|
|
|
@use templates::page_base;
|
2016-09-23 23:03:04 +03:00
|
|
|
|
2017-12-30 20:04:23 +04:00
|
|
|
@(req: &Request, lpath: &[Link], people: &[Person], places: &[Place], tags: &[Tag], position: &Option<Coord>, attribution: &Option<String>, camera: &Option<Camera>, photo: &Photo)
|
2017-08-03 21:59:21 +04:00
|
|
|
@:page_base(req, "Photo details", lpath, {
|
2018-02-05 02:42:15 +04:00
|
|
|
<div 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]"}>
|
2018-03-05 21:33:17 +04:00
|
|
|
<div class="item"><img src="/img/@photo.id-m.jpg" @if let Some(s) = photo.get_size(960) { width="@s.0" height="@s.1"}></div>
|
2017-02-03 22:44:13 +04:00
|
|
|
<div class="meta">
|
2017-08-03 21:59:21 +04:00
|
|
|
@if req.authorized_user().is_some() {
|
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() {
|
|
|
|
<p>People: @for p in people{<a href="/person/@p.slug">@p.person_name</a>, }</p>}
|
|
|
|
@if !places.is_empty() {
|
|
|
|
<p>Places: @for p in places{<a href="/place/@p.slug">@p.place_name</a>, }</p>}
|
|
|
|
@if !tags.is_empty() {
|
|
|
|
<p>Tags: @for t in tags{<a href="/tag/@t.slug">@t.tag_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>}
|
|
|
|
@if let Some(ref c) = *camera{<p>Camera: @c.model (@c.manufacturer)</p>}
|
2017-02-03 22:44:13 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-26 01:45:13 +03:00
|
|
|
})
|