{% extends "photos/base.html" %}

{% load cache gallery_tags social_tags %}

{% block title %}{{ gallery.title }}{% endblock %}

{% block extra_title %}photo galleries{% endblock %}

{% block bodyid %}gallery_detail{% endblock %}

{% block extra_meta %}
  <meta property="og:title" content="Photo Gallery: {{ gallery.title }}">
  <meta property="og:url" content="http://{{ site.domain }}{{ gallery.get_absolute_url }}">
  <meta property="og:description" content="{{ gallery.summary }}">
  <meta property="og:image" content="{{ MEDIA_URL }}{{ gallery.get_image.image }}">
  <meta property="og:type" content="gallery">
  <meta property="gallery:section" content="{{ gallery.get_section }}">
  <meta property="gallery:published_time"  content="{{ gallery.created|date:"c" }}Z">
  <meta name="description" content="{{ gallery.title }}: {{ gallery.summary }}" />
  <meta name="DC.date.issued" content="{{ gallery.created|date:"c" }}Z">  
{% endblock %}

{% block content %}
  {% cache 900 gallery gallery.id gallery.galleryimage_set.count 43 %}
    <section class="gallery-info">
      <h1>{{ gallery.title }}</h1>
      {{ gallery.summary_formatted|safe }}
      {% if gallery.gallery_credit %}
        <p class="meta">
          {{ gallery.gallery_credit }}
        </p>
      {% endif %}
    </section>
    
    <section class="slideshow">
      {% for object in gallery.galleryimage_set.all %}
        <figure id="image_{{ forloop.counter }}" class="hmedia {% if object.is_vertical %}vertical{% endif %} {% if object.caption or object.byline %}has-caption{% endif %}">
          <img src="{{ object.image.t_640.url }}" class="photo">
          {% if object.has_caption_info %}
            <figcaption>
              <div class="caption">{{ object.caption }}</div>
              <span class="byline">{{ object.byline }}</span>
              <span class="source-org">{{ object.credit }}</span>
            </figcaption>
          {% endif %}
        </figure>
      {% endfor %}
    </section> <!-- /slides -->
    {% social_links object %}

    <section class="clear">
      {% get_related_galleries gallery 4 %}
    </section>
  {% endcache %}
{% endblock %}
