Store gallery photo names in datasets for easier iterating

This commit is contained in:
2016-01-24 20:45:03 +00:00
parent 9c9a498a32
commit 283317b3b9
93 changed files with 1249 additions and 83 deletions

View File

@@ -19,18 +19,18 @@ layout: post
zoom : {{ page.map.zoom }}
}
);
{% for p in site.pages %}
{% if p.layout == 'gallery-photo' and p.gallery == page.gallery %}
{% if p.location %}
{% include gallery-photos.html gallery=page.gallery %}
{% for photo in photos %}
{% if photo.location %}
(function () {
var wo = false;
var m = new google.maps.Marker({
position: new google.maps.LatLng({{ p.location.latitude }}, {{ p.location.longitude }}),
position: new google.maps.LatLng({{ photo.location.latitude }}, {{ photo.location.longitude }}),
map : map,
title : "{{ p.title }}"
title : "{{ photo.title }}"
});
var w = new google.maps.InfoWindow({
content: '<div style="margin-bottom:5px;">{{ p.title|replace:"'","\\'" }}</div><a href="/{{ site.baseurl }}/{{ p.url }}"><img alt="Photo: {{ p.title | replace:"'","\\'" }}" height="200" src="{{ site.asset_prefix }}/gallery/{{ page.gallery }}/{{ p.name | remove:'.md' }}~200x200.jpg" title="{{ p.title|replace:"'","\\'" }}" width="200" /></a>'
content: '<div style="margin-bottom:5px;">{{ photo.title|replace:"'","\\'" }}</div><a href="/{{ site.baseurl }}/{{ photo.url }}"><img alt="Photo: {{ photo.title | replace:"'","\\'" }}" height="200" src="{{ site.asset_prefix }}/gallery/{{ page.gallery }}/{{ photo.name | remove:'.md' }}~200x200.jpg" title="{{ photo.title|replace:"'","\\'" }}" width="200" /></a>'
});
google.maps.event.addListener(
m,
@@ -45,9 +45,8 @@ layout: post
}
);
})();
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
}
);
</script>

View File

@@ -43,24 +43,23 @@
<body>
<section>
<h1>{{ page.title }}</h1>
{% for p in site.pages %}
{% if p.layout == 'gallery-photo' and p.gallery == page.gallery %}
{% include gallery-photos.html gallery=page.gallery %}
{% for photo in photos %}
<div class="photo" style="border-radius:2px;display:inline-block;margin:4px;overflow:hidden;">
{% assign maxsize = 0 %}
{% assign maxref = false %}
{% for size in p.sizes %}
{% if maxsize < size[1].height * size[1].width %}
{% assign maxsize = size[1].height * size[1].width %}
{% assign maxref = size %}
{% endif %}
{% endfor %}
<a href="{{ site.asset_prefix }}/gallery/{{ page.gallery }}/{{ p.name | remove:'.md' }}~{{ maxref[0] }}.jpg" data-size="{{ maxref[1].width }}x{{ maxref[1].height }}">
<img src="{{ site.asset_prefix }}/gallery/{{ page.gallery }}/{{ p.name | remove:'.md' }}~200x200.jpg" height="100" alt="{{ p.title }}" width="100" data-size="200x200" />
</a>
<div class="caption" style="display:none;">{{ p.content }}</div>
</div>
{% assign maxsize = 0 %}
{% assign maxref = false %}
{% for size in photo.sizes %}
{% if maxsize < size[1].height * size[1].width %}
{% assign maxsize = size[1].height * size[1].width %}
{% assign maxref = size %}
{% endif %}
{% endfor %}
<a href="{{ site.asset_prefix }}/gallery/{{ page.gallery }}/{{ photo.name | remove:'.md' }}~{{ maxref[0] }}.jpg" data-size="{{ maxref[1].width }}x{{ maxref[1].height }}">
<img src="{{ site.asset_prefix }}/gallery/{{ page.gallery }}/{{ photo.name | remove:'.md' }}~200x200.jpg" height="100" alt="{{ photo.title }}" width="100" data-size="200x200" />
</a>
<div class="caption" style="display:none;">{{ photo.content }}</div>
</div>
{% endfor %}
</section>
<!-- Root element of PhotoSwipe. Must have class pswp. -->