source.html.twig 2.35 KB
Newer Older
1
{% extends 'base.html.twig' %}
Emma's avatar
Emma committed
2 3 4

{% block html_title %}
  {{ 'title.viewing_theme_source'|trans({'%theme%': '<a href="%s">%s/%s</a>'|format(
5
    path('theme_history', {id: revision.theme.id})|e,
Emma's avatar
Emma committed
6 7 8 9 10 11 12 13 14 15
    revision.theme.author.username|e,
    revision.theme.name|e
  )})|raw }}
{% endblock %}

{% block title block('html_title')|striptags %}

{% block page_classes 'theme-source-page' %}

{% block body %}
16
  <h1 class="page-heading">{{ block('html_title') }}</h1>
Emma's avatar
Emma committed
17

Emma's avatar
Emma committed
18 19 20 21 22 23
  <p>
    <strong>{{ 'label.revision_id'|trans }}</strong>:
    <code>{{ revision.id|replace({'-': '-<wbr>'})|raw }}</code>
  </p>

  {% with {hierarchy: revision.hierarchy} %}
Emma's avatar
Emma committed
24
    {% if hierarchy|length > 1 or hierarchy[0].appendToDefaultStyle %}
Emma's avatar
Emma committed
25
      <h2>{{ 'label.hierarchy'|trans }}</h2>
Emma's avatar
Emma committed
26 27 28 29
      {% if hierarchy[0].appendToDefaultStyle %}
        <ul>
          <li><em>{{ 'label.default'|trans }}</em>
      {% endif %}
Emma's avatar
Emma committed
30 31 32 33 34 35 36 37 38
      {% for member in hierarchy %}
        <ul>
          <li>
            {% if member == revision %}
              <strong>{{ member.theme.author.username }}/{{ member.theme.name }}</strong>
            {% else %}
              {{ member.theme.author.username }}/{{ member.theme.name }}
            {% endif %}
            {% if member != revision %}
39
              (<a href="{{ path('theme_revision_source', {id: member.id}) }}">
Emma's avatar
Emma committed
40 41
                <code>{{- member.id|replace({'-': '-<wbr>'})|raw -}}</code>
              </a>)
Emma's avatar
Emma committed
42 43 44 45 46 47
            {% endif %}
      {% endfor %}
      {% for i in 0..hierarchy|length %}
          </li>
        </ul>
      {% endfor %}
Emma's avatar
Emma committed
48 49 50 51
      {% if hierarchy[0].appendToDefaultStyle %}
          </li>
        </ul>
      {% endif %}
Emma's avatar
Emma committed
52 53 54 55 56 57
    {% endif %}
  {% endwith %}

  {% if revision.commonCss is not empty %}
    <details open>
      <summary>{{ 'label.common_css'|trans }}</summary>
Emma's avatar
Emma committed
58
      <pre class="source-code"><code class="language-css">{{ revision.commonCss }}</code></pre>
Emma's avatar
Emma committed
59 60 61 62 63 64
    </details>
  {% endif %}

  {% if revision.dayCss is not empty %}
    <details open>
      <summary>{{ 'label.day_css'|trans }}</summary>
Emma's avatar
Emma committed
65
      <pre class="source-code"><code class="language-css">{{ revision.dayCss }}</code></pre>
Emma's avatar
Emma committed
66 67 68 69 70 71
    </details>
  {% endif %}

  {% if revision.nightCss is not empty %}
    <details open>
      <summary>{{ 'label.night_css'|trans }}</summary>
Emma's avatar
Emma committed
72
      <pre class="source-code"><code class="language-css">{{ revision.nightCss }}</code></pre>
Emma's avatar
Emma committed
73 74
    </details>
  {% endif %}
Emma's avatar
Emma committed
75
{% endblock %}