{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "gallery/media.html" %}
{% if media_type == 'image' %}
  {% set delete_this = _('Delete image') %}
  {% set delete_confirm = _('Are you sure you want to delete this image?') %}
  {% set delete_warning = _('You are about to permanently delete this image. <strong>This cannot be undone!</strong> Are you sure you want to continue?') %}
  {% set title = _('Delete image | {t} | Media Gallery')|f(t=media.title) %}
{% else %}
  {% set delete_this = _('Delete video') %}
  {% set delete_confirm = _('Are you sure you want to delete this video?') %}
  {% set delete_warning = _('You are about to permanently delete this video. <strong>This cannot be undone!</strong> Are you sure you want to continue?') %}
  {% set title = _('Delete video | {t} | Media Gallery')|f(t=media.title) %}
{% endif %}
{% set crumbs = [(url('gallery.gallery', media_type), _('Media Gallery')),
                 (url('gallery.media', media_type, media.id), media.title),
                 (None, delete_this)] %}

{% block content %}
  <article id="media-object-delete" class="main">
    <h1>{{ delete_confirm }}</h1>
    <div class="to-delete">
      <label>{{ _('Title') }}</label>
      <div>{{ media.title }}</div>
      <label>{{ _('Locale') }}</label>
      <div>{{ settings.LOCALES[media.locale].native }}</div>
      <label>{{ _('Description') }}</label>
      <div>{{ media.description|wiki_to_html }}</div>
      <label>{{ _('Creator') }}</label>
      <div>{{ media.creator }}</div>
      <label>{{ _('Date') }}</label>
      <div>{{ datetimeformat(media.created, format='longdatetime') }}</div>
      {% if media_type == 'video' %}
        <label>{{ _('Available formats') }}</label>
        <div>
          <ul>
            {% if media.flv %}
              <li>FLV</li>
            {% endif %}
            {% if media.ogv %}
              <li>OGV</li>
            {% endif %}
            {% if media.webm %}
              <li>WEBM</li>
            {% endif %}
          </ul>
        </div>
        <label class="clear">{{ _('Video') }}</label>
        <div>{{ generate_video(media) }}</div>
      {% else %}
        <label>{{ _('Available formats') }}</label>
        <div>{{ media_format|upper }}</div>
        <label>{{ _('Image') }}</label>
        <div><img src="{{ media.file.url }}" alt="{{ media.title }}" /></div>
      {% endif %}

      <form action="{{ url('gallery.delete_media', media_type, media.id) }}" method="post">
        {{ csrf() }}
        <p>{{ delete_warning|safe }}</p>
        <div class="form-actions">
          <a href="{{ url('gallery.media', media_type, media.id) }}">{{ _('Cancel') }}</a>
          <input type="submit" class="btn" value="{{ delete_this }}" />
        </div>
      </form>
    </div>
  </article>
{% endblock %}
