views/content/approval.html
{% extends "_donut.html" %}
{% from "components/alert.html" import alert %}
{% block pageHead %}
{{ super() }}
{% endblock %}
{% block header %}
{{ super() }}
{% endblock %}
{% block main %}
<h1 class="base--h1">{{title}}</h1>
{% if revision %}
<h2 class="base--h2">{{config.actions.approve|capitalize}} :: {{revision.identifier}}</h2>
{# Warnings #}
{# Cancel Sunset #}
{% if time.sunset.live.unix and not time.sunset.unix %}
{{ alert('approve', 'warning', 'Approving this revision will remove the current sunset')}}
{% endif %}
{# Change Sunset #}
{% if time.sunset.unix != time.sunset.live.unix and time.sunset.live.unix != 0 and time.sunset.unix != 0 %}
{{ alert('approve', 'warning', 'Approving this revision will change the current sunset from ' + time.sunset.live.human.date + ' ' + time.sunset.live.human.time + ' - ' + time.sunset.live.human.zone + ' to ' + time.sunset.human.date + ' ' + time.sunset.human.time + ' - ' + time.sunset.human.zone)}}
{% endif %}
{# Immediate Sunset #}
{% if time.sunset.unix <= time.now and time.sunset.unix != 0 %}
{{ alert('approve', 'warning', 'Approving this revision will immediately sunset this content')}}
{% endif %}
{# Sunrise That Which Will Be Sunset #}
{% if (time.sunset.live.unix and time.sunrise.unix > time.sunset.live.unix) or (time.sunset.unix and time.sunrise.unix > time.sunset.unix) %}
{{ alert('approve', 'warning', 'Approving this revision will sunrise this content after it is scheduled to sunset')}}
{% endif %}
{# Immediate Sunset #}
{% if time.sunrise.unix <= time %}
{{ alert('approve', 'warning', 'Approving this revision will immediately sunrise it')}}
{% endif %}
{# Sunrise Override #}
{% if scheduled.length > 0 %}
{% set rvs = '' %}
{% if scheduled.length == 1 %}
{% set rvs = 'revision ' %}
{% else %}
{% set rvs = 'revisions ' %}
{% endif %}
{% for item in scheduled %}
{% if not loop.first %}
{% set rvs = rvs + ', ' %}
{% endif %}
{% set rvs = rvs + item.revision %}
{% endfor %}
{{ alert('approve', 'warning', 'Approving this revision will override scheduled ' + rvs)}}
{% endif %}
{# Attribtues #}
{% if data %}
<div class="listing">
{% for attr, inputs in data %}
<h3 class="listing--h3">{{attr|capitalize}}</h3>
{% if inputs.length %}
{# repeatable content #}
{% for rpt in inputs %}
{% for input, value in rpt %}
{% if loop.first %}
<dl class="listing--dl">
{% endif %}
<dt class="listing--dt">{{input}}</dt>
<dd class="listing--dd">{{value.value}}</dd>
{% if loop.last %}
</dl>
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
{% for input, value in inputs %}
<dl class="listing--dl">
<dt class="listing--dt">{{input}}</dt>
<dd class="listing--dd">{{value.value}}</dd>
</dl>
{% endfor %}
{% endif %}
{% endfor %}
{# Sunrise/Sunset #}
<hr class="base--hr">
<h3 class="listing--h3">Sunrise/Sunset</h3>
{% if time.sunrise.human %}
<dl class="listing--dl">
<dt class="listing--dt">Sunrise</dt>
<dd class="listing--dd">{{time.sunrise.human.date}} {{time.sunrise.human.time}} - {{time.sunrise.human.zone}}</dd>
</dl>
{% endif %}
{% if time.sunset.human %}
<dl class="listing--dl">
<dt class="listing--dt">Sunset</dt>
<dd class="listing--dd">{{time.sunset.human.date}} {{time.sunset.human.time}} - {{time.sunset.human.zone}}</dd>
</dl>
{% endif %}
</div>
{% endif %}
{% include "content/_form-approval.html" %}
{% if revision.audit.entries %}
<hr class="base--hr" />
<h2 class="base--h2">Previous Comments</h2>
<table class="base--table">
<thead class="base--thead">
<tr class="base--tr">
<th class="base--th">Person</th>
<th class="base--th">Action</th>
<th class="base--th">Step</th>
<th class="base--th">Comment</th>
<th class="base--th">Date</th>
</tr>
</thead>
<tbody class="base--tbody">
{% for e in revision.audit.entries %}
<tr class="base--tr">
<td data-th="Person" class="base--td">{{e.author.email}}</td>
<td data-th="Action" class="base--td">{{e.action}}</td>
<td data-th="Step" class="base--td">{{e.step}}</td>
<td data-th="Comment" class="base--td">{{e.comment}}</td>
<td data-th="Date" class="base--td">{{e.created.date}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endif %}
{% endblock %}
{% block footer %}
{{ super() }}
{% endblock %}