sort document lists by their status
This commit is contained in:
parent
264dc9485d
commit
23faa2bb69
3 changed files with 33 additions and 10 deletions
|
@ -100,6 +100,20 @@ ul > li:before {
|
|||
margin: 0 0 1rem 0;
|
||||
}
|
||||
|
||||
.docs-header {
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
background: #303030;
|
||||
}
|
||||
|
||||
.docs-header h3 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.doc-item {
|
||||
padding: 1.2rem 1rem;
|
||||
}
|
||||
|
||||
.doc-item-text {
|
||||
display: inline-block;
|
||||
margin-right: 3em;
|
||||
|
|
|
@ -19,16 +19,21 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for document in documents %}
|
||||
<div class="text doc-item">
|
||||
<a class="doc-item-link" href="{% url "pile:retrieve" document.id %}">🔗</a>
|
||||
<a href="{% url "pile:document" document.id %}">
|
||||
<div class="doc-item-text">
|
||||
<h2>{{ document.title }}</h2>
|
||||
<h3>{{ document.author }} {{ document.published }}</h3>
|
||||
{% for status, documents in status_documents.items %}
|
||||
{% if documents|length > 0 %}
|
||||
<div class="text docs-header"><h3>{{ status.label }}</h3></div>
|
||||
{% for document in documents %}
|
||||
<div class="text doc-item">
|
||||
<a class="doc-item-link" href="{% url "pile:retrieve" document.id %}">🔗</a>
|
||||
<a href="{% url "pile:document" document.id %}">
|
||||
<div class="doc-item-text">
|
||||
<h2>{{ document.title }}</h2>
|
||||
<h3>{{ document.author }} {{ document.published }}</h3>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -78,10 +78,14 @@ class TagView(BasePileView):
|
|||
except ObjectDoesNotExist:
|
||||
raise Http404
|
||||
|
||||
status_documents = {s: [] for s in Document.DocumentStatus}
|
||||
for document in documents:
|
||||
status_documents[document.status] += [document]
|
||||
|
||||
return {
|
||||
'tag': tag if tag != "UNTAGGED" else None,
|
||||
'untagged': tag == "UNTAGGED",
|
||||
'documents': documents,
|
||||
'status_documents': status_documents,
|
||||
**base_context_data
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue