society-self-service/sspromotions/jinja2/sspromotions/bulletin_list.html

76 lines
2.5 KiB
HTML

{% extends 'sspromotions/base.html' %}
{#
Society Self-Service
Copyright © 2018 Yingtong Li (RunasSudo)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}Your bulletin items{% endblock %}
{% macro listitems(items) %}
<table class="ui selectable celled table">
<thead>
<tr>
<th class="four wide">Title</th>
<th class="ten wide">Content</th>
<th class="two wide">Actions</th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<td class="selectable"><a href="{{ url('bulletin_edit', kwargs={'id': item.id}) }}">{{ item.title }}</a></td>
<td class="selectable"><a href="{{ url('bulletin_edit', kwargs={'id': item.id}) }}">{{ item.content }}</a></td>
<td class="selectable">
<a href="{{ url('bulletin_edit', kwargs={'id': item.id}) }}" class="ui tiny primary icon button" style="margin: 0.8em 0 0.8em 0.8em;"><i class="edit icon"></i></a>
<a href="{{ url('bulletin_delete', kwargs={'id': item.id}) }}" onclick="return confirm('Are you sure you want to delete this bulletin item?');" class="ui tiny red icon button" style="margin: 0.8em 0 0.8em 0.8em;"><i class="trash icon"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro %}
{% block maincontent %}
<h1>Your bulletin items</h1>
{% if not items_past and not items_upcoming and not items_future %}
<p>You have no bulletin items to view. To create a bulletin item, click <a href="{{ url('bulletin_new') }}">Create new bulletin item</a>.</p>
{% endif %}
{% if items_upcoming %}
<h2>Upcoming bulletin items (this week)</h2>
{{ listitems(items_upcoming) }}
{% endif %}
{% if items_future %}
<h2>Future bulletin items</h2>
{{ listitems(items_future) }}
{% endif %}
{% if items_past %}
<h2>Past bulletin items</h2>
{{ listitems(items_past) }}
{% endif %}
{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}