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

76 lines
2.5 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 calendar events{% endblock %}
{% macro listitems(items) %}
<table class="ui selectable celled table">
<thead>
<tr>
<th class="two wide">Date</th>
<th class="eight wide">Title</th>
<th class="two wide">Actions</th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<td class="selectable"><a href="{{ url('calendar_edit', kwargs={'id': item.id}) }}">{{ item.date }}</a></td>
<td class="selectable"><a href="{{ url('calendar_edit', kwargs={'id': item.id}) }}">{{ item.title }}</a></td>
<td class="selectable">
<a href="{{ url('calendar_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('calendar_delete', kwargs={'id': item.id}) }}" onclick="return confirm('Are you sure you want to delete this calendar event?');" 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 calendar events</h1>
{% if not items_past and not items_upcoming and not items_future %}
<p>You have no calendar events to view. To create a calendar event, click <a href="{{ url('calendar_new') }}">Create new calendar event</a>.</p>
{% endif %}
{% if items_upcoming %}
<h2>Upcoming calendar events (next 14 days)</h2>
{{ listitems(items_upcoming) }}
{% endif %}
{% if items_future %}
<h2>Future calendar events</h2>
{{ listitems(items_future) }}
{% endif %}
{% if items_past %}
<h2>Past calendar events</h2>
{{ listitems(items_past) }}
{% endif %}
{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}