Commit a5b5a6de authored by Julian Rother's avatar Julian Rother

Move psa editing from base to index template

parent 9b87d1ff
......@@ -100,40 +100,10 @@
{% for msg in get_flashed_messages() %}
<div class="alert alert-danger" role="alert">{{ msg }}</div>
{% endfor %}
{% for msg in get_announcements(min_announcement_level) if (not request.cookies['alert-info-'+msg.id|string]) or ismod() %}
{% for msg in get_announcements(min_announcement_level) if (not request.cookies['alert-info-'+msg.id|string]) %}
<div class="alert alert-{{levels.get(msg.level, ('info', ''))[0]}}" role="alert">
{% if not ismod() %}
<a href="#" class="close" data-dismiss="alert" aria-label="close" onclick="Cookies.set('alert-info-{{msg.id}}', '1');">&times;</a>
{% endif %}
<ul class="list-unstyled">
<li>{{ valueeditor(('announcements',msg.id,'text'), msg.text|safe) }}</li>
{% if ismod() %}
<li class="pull-right">{{ valuedeletebtn(('announcements',msg.id,'deleted')) }}</li>
<li class="pull-right" style="padding-right: 5px;">
{% if not msg.visible %}
<a href="{{ url_for('edit', ref=request.url) }}&announcements.{{ msg.id }}.visible=1" class="btn btn-primary">Veröffentlichen</a>
{% elif msg.time_expire and msg.time_expire < datetime.now() %}
<a href="#" class="btn btn-danger disabled">Abgelaufen</a>
{% elif msg.time_publish and msg.time_publish > datetime.now() %}
<a href="#" class="btn btn-default disabled">Geplant</a>
{% else %}
<a href="#" class="btn btn-success disabled">Öffentlich</a>
{% endif %}
</li>
<li class="dropdown pull-right" style="padding-right: 5px;">
<span class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">{{levels.get(msg.level, ('', 'Unbekannt'))[1]}} <span class="caret"></span></span>
<ul class="dropdown-menu">
{% for level, descr in levels.items() %}
<li><a href="{{ url_for('edit', ref=request.url) }}&announcements.{{ msg.id }}.level={{ level }}">{{ descr[1] }}</a></li>
{% endfor %}
</ul>
</li>
<li>
Aktiv von {{ valueeditor(('announcements',msg.id,'time_publish'), msg.time_publish) }}
bis {{ valueeditor(('announcements',msg.id,'time_expire'), msg.time_expire) }}
</li>
{% endif %}
</ul>
<a href="#" class="close" data-dismiss="alert" aria-label="close" onclick="Cookies.set('alert-info-{{msg.id}}', '1');">&times;</a>
{{ msg.text|safe }}
</div>
{% endfor %}
{% block content %}
......
{% from 'macros.html' import preview %}
{% extends "base.html" %}
{% set page_border = 0 %}
{% set min_announcement_level = 0 %}
{% if ismod() %}
{# Little hack to not show annoucements twice #}
{% set min_announcement_level = 999 %}
{% else %}
{% set min_announcement_level = 0 %}
{% endif %}
{% block content %}
{% if ismod() %}
<div class="row">
<div class="col-xs-12">
<ul class="list-inline pull-right">
{% if ismod() %}
<li style="padding-right: 0px;">
<a class="btn btn-default" href="{{ url_for('create', table='announcements', text='Neue Ankündigung', time_publish=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), time_expire=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)+timedelta(days=7), ref=request.url) }}">Neue Ankündigung</a>
{% for msg in get_announcements() %}
<div class="alert alert-{{levels.get(msg.level, ('info', ''))[0]}}" role="alert">
<ul class="list-unstyled">
<li>{{ valueeditor(('announcements',msg.id,'text'), msg.text|safe) }}</li>
<li class="pull-right">{{ valuedeletebtn(('announcements',msg.id,'deleted')) }}</li>
<li class="pull-right" style="padding-right: 5px;">
{% if not msg.visible %}
<a href="{{ url_for('edit', ref=request.url) }}&announcements.{{ msg.id }}.visible=1" class="btn btn-primary">Veröffentlichen</a>
{% elif msg.time_expire and msg.time_expire < datetime.now() %}
<a href="#" class="btn btn-danger disabled">Abgelaufen</a>
{% elif msg.time_publish and msg.time_publish > datetime.now() %}
<a href="#" class="btn btn-default disabled">Geplant</a>
{% else %}
<a href="#" class="btn btn-success disabled">Öffentlich</a>
{% endif %}
</li>
<li class="dropdown pull-right" style="padding-right: 5px;">
<span class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">{{levels.get(msg.level, ('', 'Unbekannt'))[1]}} <span class="caret"></span></span>
<ul class="dropdown-menu">
{% for level, descr in levels.items() %}
<li><a href="{{ url_for('edit', ref=request.url) }}&announcements.{{ msg.id }}.level={{ level }}">{{ descr[1] }}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
<li>
Aktiv von {{ valueeditor(('announcements',msg.id,'time_publish'), msg.time_publish) }}
bis {{ valueeditor(('announcements',msg.id,'time_expire'), msg.time_expire) }}
</li>
</ul>
</div>
{% endfor %}
</div>
</div>
<div class="row">
<div class="col-xs-12">
<ul class="list-inline pull-right">
<li style="padding-right: 0px;">
<a class="btn btn-default" href="{{ url_for('create', table='announcements', text='Neue Ankündigung', time_publish=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), time_expire=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)+timedelta(days=7), ref=request.url) }}">Neue Ankündigung</a>
</li>
</ul>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-md-6 panel-group">
<div class="panel panel-default">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment