From 23faa2bb6912ae9aafece897cc7d33058bac528a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Wed, 15 Apr 2020 21:54:55 +0200 Subject: [PATCH] sort document lists by their status --- sdbs_pile/pile/static/main.css | 14 +++++++++++ .../pile/templates/front_doc_listing.html | 23 +++++++++++-------- sdbs_pile/pile/views.py | 6 ++++- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/sdbs_pile/pile/static/main.css b/sdbs_pile/pile/static/main.css index 02b74aa..85a8dab 100755 --- a/sdbs_pile/pile/static/main.css +++ b/sdbs_pile/pile/static/main.css @@ -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; diff --git a/sdbs_pile/pile/templates/front_doc_listing.html b/sdbs_pile/pile/templates/front_doc_listing.html index c1493dd..554d369 100644 --- a/sdbs_pile/pile/templates/front_doc_listing.html +++ b/sdbs_pile/pile/templates/front_doc_listing.html @@ -19,16 +19,21 @@ {% endif %} - {% for document in documents %} -
- 🔗 - - + {% endfor %} + {% endif %} {% endfor %} {% endblock %} diff --git a/sdbs_pile/pile/views.py b/sdbs_pile/pile/views.py index 1075535..1b8a200 100644 --- a/sdbs_pile/pile/views.py +++ b/sdbs_pile/pile/views.py @@ -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 }