2018-12-07 15:53:46 +11:00
{% 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 >
2019-02-10 13:17:46 +11:00
< td > {{ item.content|markdown }}< / td >
2018-12-07 15:53:46 +11:00
< 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 >
2019-05-05 20:03:39 +10:00
{% if not items_past_page and not items_upcoming and not items_future %}
2018-12-07 15:53:46 +11:00
< 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 %}
2019-05-05 20:03:39 +10:00
{% if items_past_page %}
2018-12-07 15:53:46 +11:00
< h2 > Past bulletin items< / h2 >
2019-05-05 20:03:39 +10:00
{{ 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() }}" > ‹ 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 › < / a >
{% endif %}
< / div >
< / div >
2018-12-07 15:53:46 +11:00
{% endif %}
{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}