<?php

/* preview.tpl */
class __TwigTemplate_29cf2838ecf0e8a899baeb524c714e15d65ce8416e4c4d10268eda4d0a46abfa extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        // line 1
        $this->parent = $this->loadTemplate("base.tpl", "preview.tpl", 1);
        $this->blocks = array(
            'page_title' => array($this, 'block_page_title'),
            'opengraph' => array($this, 'block_opengraph'),
            'content' => array($this, 'block_content'),
            'preview' => array($this, 'block_preview'),
            'siblings' => array($this, 'block_siblings'),
            'actions' => array($this, 'block_actions'),
            'share' => array($this, 'block_share'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "base.tpl";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_page_title($context, array $blocks = array())
    {
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "title", array()), "html", null, true);
        echo " — ";
        echo twig_escape_filter($this->env, (isset($context["site_name"]) ? $context["site_name"] : null), "html", null, true);
    }

    // line 5
    public function block_opengraph($context, array $blocks = array())
    {
        // line 6
        echo "  <meta property=\"og:type\" content=\"article\"/>
  <meta property=\"og:title\" content=\"";
        // line 7
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "title", array()), "html", null, true);
        echo "\"/>
  <meta property=\"article:published_time\" content=\"";
        // line 8
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "created", array()), "html", null, true);
        echo "\"/>

  ";
        // line 10
        if (($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "type", array()) == "image")) {
            // line 11
            echo "    <meta property=\"og:image\" content=\"";
            echo twig_escape_filter($this->env, (isset($context["base_link"]) ? $context["base_link"] : null), "html", null, true);
            echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getAttribute($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "metadata", array()), "images", array()), "lg", array()), "link", array()), "html", null, true);
            echo "\"/>
    <meta property=\"og:image:type\" content=\"image/jpeg\"/>
    <meta property=\"og:image:width\" content=\"";
            // line 13
            echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getAttribute($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "metadata", array()), "images", array()), "lg", array()), "width", array()), "html", null, true);
            echo "\"/>
    <meta property=\"og:image:height\" content=\"";
            // line 14
            echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getAttribute($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "metadata", array()), "images", array()), "lg", array()), "height", array()), "html", null, true);
            echo "\"/>
  ";
        }
    }

    // line 18
    public function block_content($context, array $blocks = array())
    {
        // line 19
        echo "  <div class=\"page-header\">
    <h1>";
        // line 20
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "title", array()), "html", null, true);
        echo "</h1>

    ";
        // line 22
        if ((($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "type", array()) == "image") && $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "tags", array()))) {
            // line 23
            echo "      <div class=\"tags\">";
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "tags_split", array()));
            foreach ($context['_seq'] as $context["_key"] => $context["tag"]) {
                echo "<a href='/photo/album/";
                echo twig_escape_filter($this->env, $context["tag"], "html", null, true);
                echo "'>#";
                echo twig_escape_filter($this->env, $context["tag"], "html", null, true);
                echo "</a>";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tag'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            echo "</div>
    ";
        } elseif ($this->getAttribute(        // line 24
(isset($context["file"]) ? $context["file"] : null), "tags", array())) {
            // line 25
            echo "      <div class=\"tags\">";
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "tags_split", array()));
            foreach ($context['_seq'] as $context["_key"] => $context["tag"]) {
                echo "<a href='/search?tag=";
                echo twig_escape_filter($this->env, $context["tag"], "html", null, true);
                echo "'>#";
                echo twig_escape_filter($this->env, $context["tag"], "html", null, true);
                echo "</a>";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tag'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            echo "</div>
    ";
        }
        // line 27
        echo "  </div>

  ";
        // line 29
        if ($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "description", array())) {
            // line 30
            echo "    <div class=\"description\">";
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "description", array()), "html", null, true);
            echo "</div>
  ";
        }
        // line 32
        echo "
  <div class=\"row\">
    <div class=\"col-md-6\">
      <div class=\"preview\">
        ";
        // line 36
        $this->displayBlock('preview', $context, $blocks);
        // line 43
        echo "      </div>

      ";
        // line 45
        $this->displayBlock('siblings', $context, $blocks);
        // line 64
        echo "    </div>

    <div class=\"col-md-6\">
      ";
        // line 67
        $this->displayBlock('actions', $context, $blocks);
        // line 77
        echo "
      ";
        // line 78
        $context["year"] = twig_slice($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "created", array()), 0, 4);
        // line 79
        echo "      ";
        $context["month"] = twig_slice($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "created", array()), 5, 2);
        // line 80
        echo "      ";
        $context["day"] = twig_slice($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "created", array()), 8, 2);
        // line 81
        echo "
      <p>Дата создания: <a href=\"/search?year=";
        // line 82
        echo twig_escape_filter($this->env, (isset($context["year"]) ? $context["year"] : null), "html", null, true);
        echo "\">";
        echo twig_escape_filter($this->env, (isset($context["year"]) ? $context["year"] : null), "html", null, true);
        echo "</a>-<a href=\"/search?year=";
        echo twig_escape_filter($this->env, (isset($context["year"]) ? $context["year"] : null), "html", null, true);
        echo "&amp;month=";
        echo twig_escape_filter($this->env, (isset($context["month"]) ? $context["month"] : null), "html", null, true);
        echo "\">";
        echo twig_escape_filter($this->env, (isset($context["month"]) ? $context["month"] : null), "html", null, true);
        echo "</a>-<a href=\"/search?year=";
        echo twig_escape_filter($this->env, (isset($context["year"]) ? $context["year"] : null), "html", null, true);
        echo "&amp;month=";
        echo twig_escape_filter($this->env, (isset($context["month"]) ? $context["month"] : null), "html", null, true);
        echo "&amp;day=";
        echo twig_escape_filter($this->env, (isset($context["day"]) ? $context["day"] : null), "html", null, true);
        echo "\">";
        echo twig_escape_filter($this->env, (isset($context["day"]) ? $context["day"] : null), "html", null, true);
        echo "</a> ";
        echo twig_escape_filter($this->env, twig_slice($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "created", array()), 11), "html", null, true);
        echo ".</p>

      ";
        // line 84
        if (( !$this->getAttribute((isset($context["file"]) ? $context["file"] : null), "deleted", array()) && (isset($context["share"]) ? $context["share"] : null))) {
            // line 85
            echo "        ";
            $this->displayBlock('share', $context, $blocks);
            // line 86
            echo "      ";
        }
        // line 87
        echo "    </div>
  </div>
";
    }

    // line 36
    public function block_preview($context, array $blocks = array())
    {
        // line 37
        echo "          ";
        if (($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "type", array()) == "audio")) {
            // line 38
            echo "            <audio controls=\"controls\" preload=\"auto\" style=\"width:100%\">
              <source src=\"";
            // line 39
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["meta"]) ? $context["meta"] : null), "url", array()), "html", null, true);
            echo "\" type=\"";
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["meta"]) ? $context["meta"] : null), "mimetype", array()), "html", null, true);
            echo "\" />
            </audio>
          ";
        }
        // line 42
        echo "        ";
    }

    // line 45
    public function block_siblings($context, array $blocks = array())
    {
        // line 46
        echo "        ";
        if ((isset($context["siblings"]) ? $context["siblings"] : null)) {
            // line 47
            echo "          <ul class=\"siblings\">
            ";
            // line 48
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable((isset($context["siblings"]) ? $context["siblings"] : null));
            foreach ($context['_seq'] as $context["_key"] => $context["f"]) {
                // line 49
                echo "              <li";
                if (($this->getAttribute($context["f"], "id", array()) == $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "id", array()))) {
                    echo " class=\"active\"";
                }
                echo ">
                <a href=\"";
                // line 50
                echo twig_escape_filter($this->env, $this->getAttribute($context["f"], "link", array()), "html", null, true);
                if ((isset($context["tag"]) ? $context["tag"] : null)) {
                    echo "?tag=";
                    echo twig_escape_filter($this->env, (isset($context["tag"]) ? $context["tag"] : null), "html", null, true);
                }
                echo "\" title=\"";
                echo twig_escape_filter($this->env, $this->getAttribute($context["f"], "title", array()), "html", null, true);
                echo "\">
                  ";
                // line 51
                if ($this->getAttribute($this->getAttribute($this->getAttribute($context["f"], "metadata", array()), "images", array()), "sm", array())) {
                    // line 52
                    echo "                    <div class=\"bgtn\" style=\"background-image: url(";
                    echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getAttribute($this->getAttribute($context["f"], "metadata", array()), "images", array()), "sm", array()), "link", array()), "html", null, true);
                    echo ")\"></div>
                  ";
                } elseif ($this->getAttribute($this->getAttribute($this->getAttribute(                // line 53
$context["f"], "metadata", array()), "images", array()), "md", array())) {
                    // line 54
                    echo "                    <div class=\"bgtn\" style=\"background-image: url(";
                    echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getAttribute($this->getAttribute($context["f"], "metadata", array()), "images", array()), "md", array()), "link", array()), "html", null, true);
                    echo ")\"></div>
                  ";
                } else {
                    // line 56
                    echo "                    <img src=\"/static/images/placeholder.png\" alt=\"placeholder\"/>
                  ";
                }
                // line 58
                echo "                </a>
              </li>
            ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['f'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 61
            echo "          </ul>
        ";
        }
        // line 63
        echo "      ";
    }

    // line 67
    public function block_actions($context, array $blocks = array())
    {
        // line 68
        echo "        <div class=\"form-actions\">
          <a class=\"btn btn-primary\" href=\"";
        // line 69
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "download", array()), "html", null, true);
        echo "\">Скачать файл (";
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "filesize", array()), "html", null, true);
        echo ")</a>
          ";
        // line 70
        if ((isset($context["user"]) ? $context["user"] : null)) {
            // line 71
            echo "            <a href=\"/files/";
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "id", array()), "html", null, true);
            echo "/edit\" class=\"btn btn-default\">Редактировать</a>
            <a href=\"/files/";
            // line 72
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "id", array()), "html", null, true);
            echo "/delete\" class=\"btn btn-default delete";
            if ($this->getAttribute((isset($context["file"]) ? $context["file"] : null), "deleted", array())) {
                echo " hidden";
            }
            echo "\">Удалить</a>
            <a href=\"/files/";
            // line 73
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["file"]) ? $context["file"] : null), "id", array()), "html", null, true);
            echo "/undelete\" class=\"btn btn-default undelete";
            if ( !$this->getAttribute((isset($context["file"]) ? $context["file"] : null), "deleted", array())) {
                echo " hidden";
            }
            echo "\">Восстановить</a>
          ";
        }
        // line 75
        echo "        </div>
      ";
    }

    // line 85
    public function block_share($context, array $blocks = array())
    {
    }

    public function getTemplateName()
    {
        return "preview.tpl";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  336 => 85,  331 => 75,  322 => 73,  314 => 72,  309 => 71,  307 => 70,  301 => 69,  298 => 68,  295 => 67,  291 => 63,  287 => 61,  279 => 58,  275 => 56,  269 => 54,  267 => 53,  262 => 52,  260 => 51,  250 => 50,  243 => 49,  239 => 48,  236 => 47,  233 => 46,  230 => 45,  226 => 42,  218 => 39,  215 => 38,  212 => 37,  209 => 36,  203 => 87,  200 => 86,  197 => 85,  195 => 84,  172 => 82,  169 => 81,  166 => 80,  163 => 79,  161 => 78,  158 => 77,  156 => 67,  151 => 64,  149 => 45,  145 => 43,  143 => 36,  137 => 32,  131 => 30,  129 => 29,  125 => 27,  108 => 25,  106 => 24,  90 => 23,  88 => 22,  83 => 20,  80 => 19,  77 => 18,  70 => 14,  66 => 13,  59 => 11,  57 => 10,  52 => 8,  48 => 7,  45 => 6,  42 => 5,  34 => 3,  11 => 1,);
    }
}
/* {% extends "base.tpl" %}*/
/* */
/* {% block page_title %}{{ file.title }} — {{ site_name }}{% endblock %}*/
/* */
/* {% block opengraph %}*/
/*   <meta property="og:type" content="article"/>*/
/*   <meta property="og:title" content="{{ file.title }}"/>*/
/*   <meta property="article:published_time" content="{{ file.created }}"/>*/
/* */
/*   {% if file.type == "image" %}*/
/*     <meta property="og:image" content="{{ base_link }}{{ file.metadata.images.lg.link }}"/>*/
/*     <meta property="og:image:type" content="image/jpeg"/>*/
/*     <meta property="og:image:width" content="{{ file.metadata.images.lg.width }}"/>*/
/*     <meta property="og:image:height" content="{{ file.metadata.images.lg.height }}"/>*/
/*   {% endif %}*/
/* {% endblock %}*/
/* */
/* {% block content %}*/
/*   <div class="page-header">*/
/*     <h1>{{ file.title }}</h1>*/
/* */
/*     {% if file.type == "image" and file.tags %}*/
/*       <div class="tags">{% for tag in file.tags_split %}<a href='/photo/album/{{ tag }}'>#{{ tag  }}</a>{% endfor %}</div>*/
/*     {% elseif file.tags %}*/
/*       <div class="tags">{% for tag in file.tags_split %}<a href='/search?tag={{ tag }}'>#{{ tag  }}</a>{% endfor %}</div>*/
/*     {% endif %}*/
/*   </div>*/
/* */
/*   {% if file.description %}*/
/*     <div class="description">{{ file.description }}</div>*/
/*   {% endif %}*/
/* */
/*   <div class="row">*/
/*     <div class="col-md-6">*/
/*       <div class="preview">*/
/*         {% block preview %}*/
/*           {% if file.type == "audio" %}*/
/*             <audio controls="controls" preload="auto" style="width:100%">*/
/*               <source src="{{ meta.url }}" type="{{ meta.mimetype }}" />*/
/*             </audio>*/
/*           {% endif %}*/
/*         {% endblock %}*/
/*       </div>*/
/* */
/*       {% block siblings %}*/
/*         {% if siblings %}*/
/*           <ul class="siblings">*/
/*             {% for f in siblings %}*/
/*               <li{% if f.id == file.id %} class="active"{% endif %}>*/
/*                 <a href="{{ f.link }}{% if tag %}?tag={{ tag }}{% endif %}" title="{{ f.title }}">*/
/*                   {% if f.metadata.images.sm %}*/
/*                     <div class="bgtn" style="background-image: url({{ f.metadata.images.sm.link }})"></div>*/
/*                   {% elseif f.metadata.images.md %}*/
/*                     <div class="bgtn" style="background-image: url({{ f.metadata.images.md.link }})"></div>*/
/*                   {% else %}*/
/*                     <img src="/static/images/placeholder.png" alt="placeholder"/>*/
/*                   {% endif %}*/
/*                 </a>*/
/*               </li>*/
/*             {% endfor %}*/
/*           </ul>*/
/*         {% endif %}*/
/*       {% endblock %}*/
/*     </div>*/
/* */
/*     <div class="col-md-6">*/
/*       {% block actions %}*/
/*         <div class="form-actions">*/
/*           <a class="btn btn-primary" href="{{ file.download }}">Скачать файл ({{ file.filesize }})</a>*/
/*           {% if user %}*/
/*             <a href="/files/{{ file.id }}/edit" class="btn btn-default">Редактировать</a>*/
/*             <a href="/files/{{ file.id }}/delete" class="btn btn-default delete{% if file.deleted %} hidden{% endif %}">Удалить</a>*/
/*             <a href="/files/{{ file.id }}/undelete" class="btn btn-default undelete{% if not file.deleted %} hidden{% endif %}">Восстановить</a>*/
/*           {% endif %}*/
/*         </div>*/
/*       {% endblock %}*/
/* */
/*       {% set year = file.created|slice(0,4) %}*/
/*       {% set month = file.created|slice(5,2) %}*/
/*       {% set day = file.created|slice(8,2) %}*/
/* */
/*       <p>Дата создания: <a href="/search?year={{ year }}">{{ year }}</a>-<a href="/search?year={{ year }}&amp;month={{ month }}">{{ month }}</a>-<a href="/search?year={{ year }}&amp;month={{ month }}&amp;day={{ day }}">{{ day }}</a> {{ file.created|slice(11) }}.</p>*/
/* */
/*       {% if not file.deleted and share %}*/
/*         {% block share %}{% endblock %}*/
/*       {% endif %}*/
/*     </div>*/
/*   </div>*/
/* {% endblock %}*/
/* */
