~homeworkprod/byceps

ref: aab620e36207ab5255fc3ab47d5513c803726195 byceps/byceps/blueprints/admin/news/templates/admin/news/item_view_version.html -rw-r--r-- 5.7 KiB
aab620e3 — Jochen Kupperschmidt Block attempts to publish an already published news item 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{% extends 'layout/admin/base.html' %}
{% from 'macros/admin/brand.html' import render_brand_avatar %}
{% from 'macros/datetime.html' import render_datetime %}
{% from 'macros/icons.html' import render_icon %}
{% from 'macros/misc.html' import render_notification, render_tag %}
{% from 'macros/user_avatar.html' import render_user_avatar_16_and_name %}
{% set current_page = 'news_admin' %}
{% set current_page_brand = brand %}
{% set title = 'Newspostversion ansehen' %}

{% block head %}
  <style>
    .newspost-head {
      background-color: #eeeeee;
      border-bottom: #cccccc solid 1px;
      margin-bottom: 40px;
      margin-left: -40px;
      margin-right: -40px;
      margin-top: -20px;
      padding: 20px 40px;
    }

    .newspost-head table.index > tbody > tr > th,
    .newspost-head table.index > tbody > tr > td {
      border: none;
    }

    .newspost-head summary:focus {
      outline: none;
    }

    .newspost-head summary:hover {
      cursor: pointer;
      text-decoration: underline;
    }
  </style>
{% endblock %}

{% block body %}

  <div class="newspost-head">
  {%- with item = version.item %}

    <div class="button-row button-row--compact" style="float: right;">
      {%- if g.current_user.has_permission(NewsItemPermission.update) %}
      <a class="button" href="{{ url_for('.item_update_form', item_id=item.id) }}">{{ render_icon('edit') }} <span>Bearbeiten</span></a>
      <div class="dropdown">
        <button class="dropdown-toggle button"><span>{{ render_icon('chevron-down') }}</span></button>
        <ol class="dropdown-menu dropdown-menu--right">
          <li><a class="dropdown-item" href="{{ url_for('.image_create_form', item_id=item.id) }}">{{ render_icon('add') }} Bild hinzufügen</a></li>
          {%- if not item.published and g.current_user.has_permission(NewsItemPermission.publish) %}
          <li><a class="dropdown-item" data-action="item-publish" href="{{ url_for('.item_publish', item_id=item.id) }}">{{ render_icon('published') }} News veröffentlichen</a></li>
          {%- endif %}
        </ol>
      </div>
      {%- endif %}
    </div>

    <table class="index">
      <tr>
        <th>Marke</th>
        <td>{{ render_brand_avatar(brand, '16') }} <a href="{{ url_for('.channel_index_for_brand', brand_id=brand.id) }}">{{ brand.title }}</a></td>
      </tr>
      <tr>
        <th>Kanal</th>
        <td><a href="{{ url_for('.channel_view', channel_id=item.channel.id) }}">{{ item.channel.id }}</a></td>
      </tr>
      <tr>
        <th>Slug</th>
        <td>{{ item.slug }}</td>
      </tr>
      <tr>
        <th>Version</th>
        <td>
          {{- version.id -}}
          {%- if is_current_version %}
          {{ render_tag('aktuell', class='color-success') }}
          {%- else %}
          {{ render_tag('veraltet', class='color-warning') }}<br>
          (<a href="{{ url_for('.item_view', item_id=item.id) }}">zur aktuellen Version</a>)
          {%- endif %}
        </td>
      </tr>
      <tr>
        <th>Erstellt</th>
        <td>
          {{ render_datetime(version.created_at|utc_to_local_tz) }} von {{ render_user_avatar_16_and_name(version.creator) }}<br>
          <a href="{{ url_for('.item_list_versions', item_id=item.id) }}">{{ render_icon('history') }} Änderungshistorie ansehen</a>
        </td>
      </tr>
      <tr>
        <th>Veröffentlicht</th>
        <td>
          {%- if version.item.published %}
          {{- render_datetime(version.item.published_at|utc_to_local_tz) }}
          {%- else %}
          {{- render_tag('Entwurf') }}
          {%- endif -%}
        </td>
      </tr>
      <tr>
        <th>Bilder ({{ item.images|length }})</th>
        <td>
          {%- if item.images %}
            {%- for image in item.images|sort(attribute='number') %}
            <details>
              <summary>#{{ image.number }}: <span class="monospace">{{ image.filename }}</span></summary>
              <div style="margin-bottom: 1rem; margin-left: 1rem;">
                <table class="index">
                  <tr>
                    <th>ID</th>
                    <td class="monospace">{{ image.id }}</td>
                  </tr>
                  <tr>
                    <th>Dateiname</th>
                    <td class="monospace">{{ image.filename }}</td>
                  </tr>
                  <tr>
                    <th>Alternativtext</th>
                    <td>{{ image.alt_text|fallback }}</td>
                  </tr>
                  <tr>
                    <th>Bildunterschrift</th>
                    <td>{{ image.caption|fallback }}</td>
                  </tr>
                  <tr>
                    <th>Quelle</th>
                    <td>{{ image.attribution|fallback }}</td>
                  </tr>
                </table>
                {%- if g.current_user.has_permission(NewsItemPermission.update) -%}
                <p><a class="button button--compact" href="{{ url_for('.image_update_form', image_id=image.id) }}">{{ render_icon('edit') }} <span>Bearbeiten</span></a></p>
                {%- endif -%}
              </div>
            </details>
            {%- endfor %}
          {%- else %}
          {{ 'keine'|dim }}
          {%- endif %}
        </td>
      </tr>
    </table>

  {%- endwith %}
  </div>

  <h1>{{ version.title }}</h1>

  {%- if error_occurred %}
    {%- set notification_body %}
        Entschuldigung, es ist ein Fehler aufgetreten.<br>
        <pre style="white-space: pre-wrap;">{{ error_message }}</pre>
    {%- endset %}
    {{ render_notification(notification_body, category='danger', icon='warning') }}
  {%- else %}
{{ rendered_body|safe }}
  {%- endif %}

{%- endblock %}

{% block scripts %}
<script>
  onDomReady(function() {
    confirmed_post_on_click_then_reload('[data-action="item-publish"]', 'Newspost veröffentlichen?');
  });
</script>
{% endblock %}