diff options
-rw-r--r-- | app/posts/templates/photo_essay_detail.html | 2 | ||||
-rw-r--r-- | app/utils/util.py | 18 | ||||
-rw-r--r-- | templates/lib/img_cluster.html | 17 |
3 files changed, 15 insertions, 22 deletions
diff --git a/app/posts/templates/photo_essay_detail.html b/app/posts/templates/photo_essay_detail.html index 8195ae7..0655f40 100644 --- a/app/posts/templates/photo_essay_detail.html +++ b/app/posts/templates/photo_essay_detail.html @@ -18,7 +18,7 @@ </a> </figure>{%endwith%} <div class="folio-wrapper"> - <article class="h-entry hentry content" itemscope itemType="http://schema.org/BlogPosting"> + <article class="h-entry hentry" itemscope itemType="http://schema.org/BlogPosting"> <header id="header" class="post-header"> <h1 class="p-name post-title" itemprop="headline">{{object.title|smartypants|safe}}</h1> <div class="post-dateline"> diff --git a/app/utils/util.py b/app/utils/util.py index 32a9838..5370d7a 100644 --- a/app/utils/util.py +++ b/app/utils/util.py @@ -78,43 +78,29 @@ def parse_image(s): image_id = img['id'].split("image-")[1] i = apps.get_model('media', 'LuxImage').objects.get(pk=image_id) caption = False - exif = False cluster_class = None is_cluster = False - extra = None if cl[0] == 'cluster': - css_class = cl[0] is_cluster = True cluster_class = cl[1] + css_class = cl[0] try: if cl[2] == 'caption': caption = True - elif cl[2] == 'exif': - exif = True - else: - extra = cl[2] - - if len(cl) > 3: - if cl[3] == 'exif': - exif = True except: pass elif cl[0] != 'cluster' and len(cl) > 1: css_class = cl[0] if cl[1] == 'caption': caption = True - if cl[1] == 'exif': - exif = True elif cl[0] != 'cluster' and len(cl) > 2: css_class = cl[0] if cl[1] == 'caption': caption = True - if cl[2] == 'exif': - exif = True print('caption'+str(caption)) else: css_class = cl[0] - return render_to_string("lib/img_%s.html" % css_class, {'image': i, 'caption': caption, 'exif': exif, 'is_cluster': is_cluster, 'cluster_class': cluster_class, 'extra': extra}) + return render_to_string("lib/img_%s.html" % css_class, {'image': i, 'caption': caption, 'is_cluster': is_cluster, 'cluster_class': cluster_class}) except KeyError: ''' regular inline image, not a luximage ''' return str(img) diff --git a/templates/lib/img_cluster.html b/templates/lib/img_cluster.html index 317bf8b..8117298 100644 --- a/templates/lib/img_cluster.html +++ b/templates/lib/img_cluster.html @@ -1,6 +1,13 @@ -{% load get_image_by_size %}{% if caption or exif %}<figure {%if cluster_class != "picwide"%}class="{{cluster_class}}"{%endif%}>{%endif%} - <a href="{%get_image_by_size image "original"%}" title="view larger image {% if image.photo_credit_source%}(photo by {{image.photo_credit_source}}){%endif%}"> - <img class="{% if caption or exif %}{%else%}{%if cluster_class != "picwide"%}{{cluster_class}}{%endif%}{%endif%} {%if extra%}{{extra}}{%endif%}" {%if cluster_class == "picwide"%} sizes="(max-width: 1439px) 100vw, (min-width: 1440px) 1440px" srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.slug %} {{size.width}}w{% if forloop.last%}"{%else%}, {%endif%}{%endfor%}{% for size in image.sizes.all%}{%if not forloop.first and not forloop.last%} src="{% get_image_by_size image size.slug%}"{%endif%}{%endfor%}{%else%} src="{% get_image_by_size image cluster_class %}"{%endif%} alt="{%if image.alt %}{{image.alt}}{%else%}{{image.title}}{%endif%} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}Scott Gilbertson{%endif%}"></a> -{% if caption or exif %}<figcaption>{% endif %}{% if caption %}{{image.caption|safe}}{% endif %}{% if exif %} | <small>Camera: {{image.exif_make}} {{image.exif_model}} with {{image.exif_lens}}</small>{% endif %}{% if caption or exif %}</figcaption> -</figure> +{% load get_image_by_size %}{%if cluster_class != "picwide"%}<span class="{{cluster_class}}">{%endif%} +{% if caption %}<figure {%if cluster_class != "picwide"%}class="{{cluster_class}}"{%endif%}>{%endif%} + <a href="{%get_image_by_size image "original"%}" title="view larger image"> + <img {%if cluster_class == "picwide"%} class="picwide" + sizes="(max-width: 1439px) 100vw, (min-width: 1440px) 1440px" srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.slug %} {{size.width}}w{% if forloop.last%}"{%else%}, {%endif%}{%endfor%} + {% for size in image.sizes.all%}{%if not forloop.first and not forloop.last%} src="{% get_image_by_size image size.slug%}"{%endif%}{%endfor%} + {%else%} + src="{% get_image_by_size image cluster_class %}" + {%endif%} + alt="{%if image.alt %}{{image.alt}}{%else%}{{image.title}}{%endif%} by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}Scott Gilbertson{%endif%}"></a> + {% if caption %}<figcaption>{{image.caption|safe}}</figcaption></figure> {% endif %} + {%if cluster_class != "picwide"%}</span>{%endif%} |