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

87 lines
2.6 KiB
HTML

{% extends 'sspromotions/base.html' %}
{#
Society Self-Service
Copyright © 2018-2019 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="five wide">Title</th>
<th class="ten wide">Content</th>
<th class="one wide">Edit</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>{{ item.content|markdown }}</td>
<td>
<a href="{{ url('bulletin_edit', kwargs={'id': item.id}) }}" class="ui tiny primary icon button"><i class="edit icon"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro %}
{% block maincontent %}
<h1>Your bulletin items</h1>
{% if not items_past_page 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_page %}
<h2>Past bulletin items</h2>
{{ listitems(items_past_page.object_list) }}
<div style="text-align: center;">
<div class="ui pagination menu">
{% if items_past_page.has_previous() %}
<a class="item" href="?page={{ items_past_page.previous_page_number() }}">&lsaquo; Prev</a>
{% endif %}
<a class="active item">Page {{ items_past_page.number }} of {{ items_past_page.paginator.num_pages }}</a>
{% if items_past_page.has_next() %}
<a class="item" href="?page={{ items_past_page.next_page_number() }}">Next &rsaquo;</a>
{% endif %}
</div>
</div>
{% endif %}
{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}