khana/templates/message_list.html

78 lines
2.9 KiB
HTML

{% extends "listing.html" %}
{% load format %}
{% block datacontent %}
<div class="card mb-0">
<div class="card-header">
<h4 class="card-title"> Mailbox{% if message_type == 'received' %} : inbox{% else %} : sentbox{% endif %}</h4>
<div class="text-right">
<a href="{% url 'compose_message' %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-pencil"></i>
</button>
</a>
</div>
</div>
<div class="card-body pb-0">
<div class="table-responsive pb-0">
{% if message_list.count >= 1 %}
<table class="table tablesorter mb-0" data-sort="table" id="maintable">
<thead class="text-primary">
<tr>
<th></th>
<th class="header">Title</th>
<th class="header text-center">Sender</th>
<th class="header text-center">Date</th>
</tr>
</thead>
<tbody>
{% for message in message_list %}
<tr>
<td>
{% if type == 'received' and message.is_read == True %}
<a href="{% url 'delete_message' message.id %}">
<span class="tim-icons icon-simple-remove text-warning"></span>
</a>
{% endif %}
</td>
<td><a href="{% url 'message_details' message.id %}" {% if type == 'received' and message.is_read == False %}style="font-weight: bold;"{% endif %}>{{ message.title }}</a></td>
<td class="text-center">{{ message.sender }}</td>
<td>{{ message.written_at | date:"d M Y H:i" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<table class="table table-striped" data-sort="table" id="maintable">
<tr>
<td>You have no mail…</td>
</tr>
</table>
{% endif %}
</div>
</div>
<div class="card-footer text-right text-muted pt-0">
<a href="{% url 'compose_message' %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-pencil"></i>
</button>
</a>
</div>
</div>
{% endblock %}
{% block footerscript %}
<script type="text/javascript">
$(document).ready(function() {
$('[data-sort="table"]').tablesorter({
headers: {
0: { sorter: false },
},
// dateFormat: "uk",
sortList: [[3,0]]
})
});
</script>
{% endblock %}