link to gallery, show related content for single photo page

This commit is contained in:
root 2017-12-23 13:24:23 +00:00
parent 01afa5aa3f
commit f4f6b440b8
4 changed files with 57 additions and 50 deletions

View File

@ -59,9 +59,16 @@
document.querySelectorAll('.select-image').forEach(function(a) {
a.onclick = function(event) {
event.preventDefault();
slider.goToSlide(this.dataset.id)
slider.goToSlide(parseInt(this.dataset.id) - 1)
document.location.hash = '#' + this.dataset.id;
};
});
if (document.querySelectorAll('.select-image').length && document.location.hash.length) {
var slide = parseInt(document.location.hash.slice(1))
if (slide) {
slider.goToSlide(slide - 1)
}
}
$(document).keydown(function(e){
if (e.keyCode == 39) // Right arrow

View File

@ -2,7 +2,7 @@
<h6><strong>Gallery: {{gallery.title}}</strong></h6>
<ul class="clearing-thumbs" data-clearing>
{% for photo in gallery.public %}
<li><a href="{{ photo.get_absolute_url }}"><img src="{{ photo.get_thumbnail_url }}"></a></li>
<li><a href="{{ gallery.get_absolute_url }}#{{forloop.counter}}"><img src="{{ photo.get_thumbnail_url }}"></a></li>
{% endfor %}
</ul>
{% endif %}

View File

@ -4,15 +4,39 @@
{% block title %}{{ gallery.title }}{% endblock %}
{% block content %}
<div class="row col-lg-12">
<h1 class="page-header">{{ gallery.title }}</h1>
<p class="muted"><small>{% trans "Published" %} {{ gallery.date_added }}</small></p>
{% if gallery.description %}{{ gallery.description|safe }}{% endif %}
{% for photo in gallery.public %}
<a href="{{ photo.get_absolute_url }}">
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}">
</a>
{% endfor %}
<div><a href="{% url 'photologue:gallery-list' %}" class="btn btn-default">{% trans "View all galleries" %}</a></div>
<div class="row">
<div class="medium-9 columns">
{% if gallery.content.exists %}
<h6 class="page-header"><a href="{{ gallery.content.all.0.get_absolute_url }}">Back to {{ gallery.content.all.0.title }}</a></h6>
{% endif %}
<h5>{{ gallery.title }}</h5>
<ul class="slider1">
{% for photo in gallery.public %}
<li id="slide-{{photo.slug}}">
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
<p>
{{ photo.caption|safe }}
{% if photo.caption %}<br>{%endif%}
<a href="{{ photo.image.url }}" target="_blank" >Link to original file</a>
</p>
</li>
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
<br>
<p>{% trans "Other photos" %}:</p>
<div>
{% for photo in gallery.public %}
<div style="float: left; padding: 4px">
<a href="{{ photo.get_absolute_url }}" class="select-image" data-id="{{forloop.counter}}">
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}">
</a>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}

View File

@ -4,45 +4,21 @@
{% block title %}{{ object.title }}{% endblock %}
{% block content %}
{% for gallery in object.public_galleries %}
<div class="row">
<div class="medium-9 columns">
<div class="row">
<div class="medium-9 columns">
<img src="{{ object.get_display_url }}" alt="{{ object.title }}">
<p>
{{ object.caption|safe }}
{% if object.caption %}<br>{%endif%}
<a href="{{ object.image.url }}" target="_blank" >Link to original file</a>
</p>
<ul>
{% for gallery in object.public_galleries %}
{% if gallery.content.exists %}
<h6 class="page-header"><a href="{{ gallery.content.all.0.get_absolute_url }}">Back to {{ gallery.content.all.0.title }}</a></h6>
<li><a href="{{ gallery.content.all.0.get_absolute_url }}">{{ gallery.content.all.0.title }}</a></li>
{% endif %}
<h5>{{ gallery.title }}</h5>
<ul class="slider1">
{% for photo in gallery.public %}
<li id="slide-{{photo.slug}}">
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
<p>
{{ photo.caption|safe }}
{% if photo.caption %}<br>{%endif%}
<a href="{{ photo.image.url }}" target="_blank" >Link to original file</a>
</p>
</li>
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
{% if object.public_galleries %}
<br>
<p>{% trans "Other photos" %}:</p>
<div>
{% for photo in gallery.public %}
<div style="float: left; padding: 4px">
<a href="{{ photo.get_absolute_url }}" class="select-image" data-id="{{forloop.counter}}">
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}">
</a>
</div>
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
</ul>
</div>
{% endfor %}
<script>
</script>
</div>
{% endblock %}