aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/blueprints/threads/__init__.py2
-rw-r--r--app/templates/macros/threads.html47
-rw-r--r--app/templates/packages/view.html2
-rw-r--r--app/templates/threads/list.html4
4 files changed, 33 insertions, 22 deletions
diff --git a/app/blueprints/threads/__init__.py b/app/blueprints/threads/__init__.py
index 09b5eb7..1455c5d 100644
--- a/app/blueprints/threads/__init__.py
+++ b/app/blueprints/threads/__init__.py
@@ -41,6 +41,8 @@ def list_all():
pid = get_int_or_abort(pid)
query = query.filter_by(package_id=pid)
+ query = query.order_by(db.desc(Thread.created_at))
+
return render_template("threads/list.html", threads=query.all())
diff --git a/app/templates/macros/threads.html b/app/templates/macros/threads.html
index 16b67a0..50be4fd 100644
--- a/app/templates/macros/threads.html
+++ b/app/templates/macros/threads.html
@@ -60,24 +60,31 @@
{% endif %}
{% endmacro %}
-{% macro render_threadlist(threads, list_group=False) -%}
- {% if not list_group %}<ul>{% endif %}
- {% for t in threads %}
- <li {% if list_group %}class="list-group-item"{% endif %}>
- {% if list_group %}
- <a href="{{ url_for('threads.view', id=t.id) }}">
- {% if t.private %}&#x1f512; {% endif %}
- {{ t.title }}
- by {{ t.author.display_name }}
- </a>
- {% else %}
- {% if t.private %}&#x1f512; {% endif %}
- <a href="{{ url_for('threads.view', id=t.id) }}">{{ t.title }}</a>
- by {{ t.author.display_name }}
- {% endif %}
- </li>
- {% else %}
- <li {% if list_group %}class="list-group-item"{% endif %}><i>No threads found</i></li>
- {% endfor %}
- {% if not list_group %}</ul>{% endif %}
+{% macro render_threadlist(threads, compact=False) -%}
+ {% for t in threads %}
+ <a class="list-group-item list-group-item-action"
+ href="{{ url_for('threads.view', id=t.id) }}">
+ {% if not compact %}
+ <span class="text-muted float-right">
+ {{ t.created_at | datetime }}
+ </span>
+
+ <span class="mr-2">
+ {% if not t.review %}
+ <i class="fas fa-comment-alt" style="color:#666;"></i>
+ {% elif t.review.recommends %}
+ <i class="fas fa-thumbs-up" style="color:#6f6;"></i>
+ {% else %}
+ <i class="fas fa-thumbs-down" style="color:#f66;"></i>
+ {% endif %}
+ </span>
+ {% endif %}
+
+ {% if t.private %}&#x1f512; {% endif %}
+ <strong>{{ t.title }}</strong>
+ by {{ t.author.display_name }}
+ </a>
+ {% else %}
+ <p>{% if list_group %}class="list-group-item"{% endif %}><i>No threads found</i></p>
+ {% endfor %}
{% endmacro %}
diff --git a/app/templates/packages/view.html b/app/templates/packages/view.html
index 53c7d74..dbac31e 100644
--- a/app/templates/packages/view.html
+++ b/app/templates/packages/view.html
@@ -409,7 +409,7 @@
</div>
<ul class="list-group list-group-flush">
{% from "macros/threads.html" import render_threadlist %}
- {{ render_threadlist(threads, list_group=True) }}
+ {{ render_threadlist(threads, compact=True) }}
</ul>
</div>
diff --git a/app/templates/threads/list.html b/app/templates/threads/list.html
index 7e27325..2d86190 100644
--- a/app/templates/threads/list.html
+++ b/app/templates/threads/list.html
@@ -8,5 +8,7 @@ Threads
<h1>Threads</h1>
{% from "macros/threads.html" import render_threadlist %}
- {{ render_threadlist(threads) }}
+ <div class="list-group">
+ {{ render_threadlist(threads) }}
+ </div>
{% endblock %}