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

View File

@ -4,16 +4,15 @@
{% block title %}{{ gallery.title }}{% endblock %} {% block title %}{{ gallery.title }}{% endblock %}
{% block content %} {% block content %}
<div class="row col-lg-12"> <div class="row col-lg-12">
<h1 class="page-header">{{ gallery.title }}</h1> <h1 class="page-header">{{ gallery.title }}</h1>
<p class="muted"><small>{% trans "Published" %} {{ gallery.date_added }}</small></p> <p class="muted"><small>{% trans "Published" %} {{ gallery.date_added }}</small></p>
{% if gallery.description %}{{ gallery.description|safe }}{% endif %} {% if gallery.description %}{{ gallery.description|safe }}{% endif %}
{% for photo in gallery.public %} {% for photo in gallery.public %}
<a href="{{ photo.get_absolute_url }}"> <a href="{{ photo.get_absolute_url }}">
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}"> <img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}">
</a> </a>
{% endfor %} {% endfor %}
<div><a href="{% url 'photologue:gallery-list' %}" class="btn btn-default">{% trans "View all galleries" %}</a></div> <div><a href="{% url 'photologue:gallery-list' %}" class="btn btn-default">{% trans "View all galleries" %}</a></div>
</div> </div>
{% endblock %} {% endblock %}

View File

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