From f4f6b440b872b75720a41939eb36d50c19602a84 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 23 Dec 2017 13:24:23 +0000 Subject: [PATCH] link to gallery, show related content for single photo page --- content/templates/base.html | 9 +++- content/templates/gallery.html | 2 +- .../templates/photologue/gallery_detail.html | 44 ++++++++++++---- .../templates/photologue/photo_detail.html | 52 +++++-------------- 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/content/templates/base.html b/content/templates/base.html index 0aa4559..d6acc02 100644 --- a/content/templates/base.html +++ b/content/templates/base.html @@ -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 diff --git a/content/templates/gallery.html b/content/templates/gallery.html index 7c3a268..3f1153c 100644 --- a/content/templates/gallery.html +++ b/content/templates/gallery.html @@ -2,7 +2,7 @@
Gallery: {{gallery.title}}
{% endif %} diff --git a/content/templates/photologue/gallery_detail.html b/content/templates/photologue/gallery_detail.html index 807b295..edbda41 100644 --- a/content/templates/photologue/gallery_detail.html +++ b/content/templates/photologue/gallery_detail.html @@ -4,15 +4,39 @@ {% block title %}{{ gallery.title }}{% endblock %} {% block content %} -
-

{{ gallery.title }}

-

{% trans "Published" %} {{ gallery.date_added }}

- {% if gallery.description %}{{ gallery.description|safe }}{% endif %} - {% for photo in gallery.public %} - - {{ photo.title }} - - {% endfor %} -
{% trans "View all galleries" %}
+
+
+ {% if gallery.content.exists %} + + {% endif %} +
{{ gallery.title }}
+
    + {% for photo in gallery.public %} +
  • + {{ photo.title }} +

    + {{ photo.caption|safe }} + {% if photo.caption %}
    {%endif%} + Link to original file +

    + +
  • + {% endfor %} +
+
+
+

{% trans "Other photos" %}:

+
+ {% for photo in gallery.public %} +
+ + {{ photo.title }} + +
+ {% endfor %} +
+
+
+ {% endblock %} diff --git a/content/templates/photologue/photo_detail.html b/content/templates/photologue/photo_detail.html index d3177f9..af0566a 100644 --- a/content/templates/photologue/photo_detail.html +++ b/content/templates/photologue/photo_detail.html @@ -4,45 +4,21 @@ {% block title %}{{ object.title }}{% endblock %} {% block content %} -{% for gallery in object.public_galleries %} -
-
+
+
+ {{ object.title }} +

+ {{ object.caption|safe }} + {% if object.caption %}
{%endif%} + Link to original file +

+
-
- {% if object.public_galleries %} -
-

{% trans "Other photos" %}:

-
- {% for photo in gallery.public %} -
- - {{ photo.title }} - -
- {% endfor %} -
- {% endif %} -
+ {% endfor %} +
-{% endfor %} - - +
{% endblock %}