related photos

This commit is contained in:
root 2017-12-23 12:19:35 +00:00
parent daf305d123
commit 01afa5aa3f
3 changed files with 57 additions and 53 deletions

View File

@ -51,21 +51,27 @@
<script src="{% static "js/jquery.bxslider.js" %}"></script>
<script type="text/javascript">
$(document).ready(function(){
var slider = $('.slider1').bxSlider({
slider = $('.slider1').bxSlider({
adaptiveHeight : true,
pager : false,
});
document.querySelectorAll('.select-image').forEach(function(a) {
a.onclick = function(event) {
event.preventDefault();
slider.goToSlide(this.dataset.id)
};
});
$(document).keydown(function(e){
if (e.keyCode == 39) // Right arrow
{
slider.goToNextSlide();
slider && slider.goToNextSlide();
return false;
}
else if (e.keyCode == 37) // left arrow
{
slider.goToPrevSlide();
slider && slider.goToPrevSlide();
return false;
}
});

View File

@ -15,5 +15,4 @@
{% endfor %}
<div><a href="{% url 'photologue:gallery-list' %}" class="btn btn-default">{% trans "View all galleries" %}</a></div>
</div>
{% endblock %}

View File

@ -12,38 +12,37 @@
{% endif %}
<h5>{{ gallery.title }}</h5>
<ul class="slider1">
{% for photo.pk in gallery.public %}
<li>
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
<br /> <p>{{ photo.caption|safe }} <a href="{{ photo.image.url }}"> Link to original file </a> </p>
</li>
{% for photo in gallery.public %}
<li>
<li id="slide-{{photo.slug}}">
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
<br /> <p>{{ photo.caption|safe }} <a href="{{ photo.image.url }}" target="_blank" > Link to original file </a> </p>
<p>
{{ photo.caption|safe }}
{% if photo.caption %}<br>{%endif%}
<a href="{{ photo.image.url }}" target="_blank" >Link to original file</a>
</p>
</li>
{% endfor %}
{% endfor %}
</ul>
}
</div>
<div class="medium-3 columns">
{% if object.public_galleries %}
<br>
<p>{% trans "Other photos" %}:</p>
<table>
<div>
{% for photo in gallery.public %}
<tr>
<td><a href="{{ photo.get_absolute_url }}">
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}"></a></td>
<td>
<p>{{ photo.caption|safe }} {{ photo.count }} </p>
</td>
</tr>
<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 %}
</table>
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
<script>
</script>
{% endblock %}