2016-09-26 01:45:13 +03:00
|
|
|
@use ::{Coord, Link};
|
2016-09-23 23:03:04 +03:00
|
|
|
@use rphotos::models::{Photo, Person, Place, Tag, Camera};
|
2016-09-26 01:45:13 +03:00
|
|
|
@use templates::page_base;
|
2016-09-23 23:03:04 +03:00
|
|
|
|
2017-02-12 20:56:26 +04:00
|
|
|
@(lpath: &[Link], user: Option<String>, people: &[Person], places: &[Place], tags: &[Tag], position: Option<Coord>, attribution: Option<String>, camera: Option<Camera>, photo: Photo)
|
2017-02-12 18:24:39 +04:00
|
|
|
@:page_base("Photo details", lpath, &user, {
|
2017-02-03 22:44:13 +04:00
|
|
|
<div class="details">
|
|
|
|
<div class="item"><img src="/img/@photo.id-m.jpg"></div>
|
|
|
|
<div class="meta">
|
2017-02-12 18:24:39 +04:00
|
|
|
@if user.is_some() {<p><a href="/img/@photo.id-l.jpg">@photo.path</a></p>}
|
2017-02-03 22:44:13 +04:00
|
|
|
@if let Some(g) = photo.grade {<p>Betyg: @g</p>}
|
2017-02-12 20:56:26 +04:00
|
|
|
@if let Some(d) = photo.date{<p>Tid: @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>}
|
|
|
|
@if let Some(ref pos) = position {<p>Position: @pos.x @pos.y</p>}
|
2017-02-12 01:24:35 +04:00
|
|
|
@if let Some(ref a) = attribution {<p>Av: @a</p>}
|
2017-02-03 22:44:13 +04:00
|
|
|
@if let Some(ref c) = camera{<p>Camera: @c.model (@c.manufacturer)</p>}
|
2016-09-23 23:03:04 +03:00
|
|
|
|
2016-09-26 01:45:13 +03:00
|
|
|
@if let Some(ref pos) = position {
|
2016-09-23 23:03:04 +03:00
|
|
|
<div id="map"></div>
|
|
|
|
<script language="javascript" type="text/javascript">
|
2016-12-06 13:35:18 +04:00
|
|
|
function initmap() @{
|
2016-11-20 15:33:37 +03:00
|
|
|
var csslink = document.createElement('link');
|
|
|
|
csslink.rel = 'stylesheet';
|
|
|
|
csslink.href = 'https://rasmus.krats.se/static/leaflet077c/leaflet.css';
|
2016-12-06 13:35:18 +04:00
|
|
|
document.getElementsByTagName('head')[0].append(csslink);
|
2016-09-23 23:03:04 +03:00
|
|
|
var pos = [@pos.x, @pos.y];
|
|
|
|
var map = document.getElementById('map');
|
|
|
|
map.style.height = 3 * map.clientWidth / 4 + "px";
|
|
|
|
var map = L.map('map').setView(pos, 16);
|
|
|
|
L.tileLayer('//@{s@}.tile.openstreetmap.org/@{z@}/@{x@}/@{y@}.png', @{
|
|
|
|
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
|
|
|
@}).addTo(map);
|
|
|
|
L.marker(pos).addTo(map);
|
2016-11-20 15:33:37 +03:00
|
|
|
@}
|
|
|
|
</script>
|
2016-12-06 13:35:18 +04:00
|
|
|
<script language="javascript" src="https://rasmus.krats.se/static/leaflet077c/leaflet.js" type="text/javascript" async onload="initmap()">
|
2016-09-23 23:03:04 +03:00
|
|
|
</script>
|
|
|
|
}
|
2017-02-11 18:23:03 +04:00
|
|
|
<script type="text/javascript">
|
|
|
|
var e = document.querySelector('.details .item');
|
|
|
|
e.addEventListener('click', function()@{ e.classList.toggle('zoom');@});
|
|
|
|
</script>
|
2017-02-03 22:44:13 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-26 01:45:13 +03:00
|
|
|
})
|