Clean up todo topics related HTML

This commit is contained in:
rubenwardy 2018-06-02 19:41:13 +01:00
parent a6f4249afb
commit 3657316fa2
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
5 changed files with 41 additions and 24 deletions

View File

@ -60,5 +60,5 @@ rm db.sqlite && python setup.py -t && FLASK_CONFIG=../config.cfg FLASK_APP=app/_
FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate
# Run migration # Run migration
FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db upgrade
``` ```

View File

@ -5,8 +5,10 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if canApproveNew %} <h2>Awaiting Approval</h2>
<h2>Packages Awaiting Approval</h2>
{% if canApproveNew and packages %}
<h3>Packages</h3>
<ul> <ul>
{% for p in packages %} {% for p in packages %}
<li><a href="{{ p.getDetailsURL() }}"> <li><a href="{{ p.getDetailsURL() }}">
@ -18,8 +20,8 @@
</ul> </ul>
{% endif %} {% endif %}
{% if canApproveScn %} {% if canApproveScn and screenshots %}
<h2>Screenshots Awaiting Approval</h2> <h3>Screenshots</h3>
<ul> <ul>
{% for s in screenshots %} {% for s in screenshots %}
<li> <li>
@ -35,8 +37,8 @@
</ul> </ul>
{% endif %} {% endif %}
{% if canApproveRel %} {% if canApproveRel and releases %}
<h2>Releases Awaiting Approval</h2> <h3>Releases</h3>
<ul> <ul>
{% for r in releases %} {% for r in releases %}
<li> <li>
@ -52,11 +54,17 @@
</ul> </ul>
{% endif %} {% endif %}
<h2>Forum Topics without a Package</h2> {% if not (packages or screenshots or releases) %}
<p>
<i>All done!</i>
</p>
{% endif %}
<h2>Unadded Topic List</h2>
<p> <p>
There are There are
<a href="{{ url_for('todo_topics_page') }}">{{ topics_to_add }} packages</a> <a href="{{ url_for('todo_topics_page') }}">{{ topics_to_add }} packages</a>
to be added to cdb. to be added to cdb, based on forum topics picked up by Krock's mod search.
</p> </p>
{% endblock %} {% endblock %}

View File

@ -100,24 +100,31 @@
{% if topics_to_add %} {% if topics_to_add %}
<div class="box box_grey"> <div class="box box_grey">
<h2>Topics to Add</h2> <h2>Unadded Packages</h2>
<table class="box-body"> <div class="box-body">
<tr> <p>
<th>Id</th> List of your topics without a matching package.
<th>Title</th> Powered by Krock's Mod Search.
<th>Name</th> </p>
<th>Link</th>
</tr> <table>
{% for topic in topics_to_add %}
<tr> <tr>
<td>{{ topic.topic_id }}</td> <th>Id</th>
<td>[{{ topic.getType().value }}] <a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a></td> <th>Title</th>
<td>{{ topic.name or ""}}</td> <th>Name</th>
<td><a href="{{ topic.link }}">{{ topic.link | domain }}</a></td> <th>Link</th>
</tr> </tr>
{% endfor %} {% for topic in topics_to_add %}
</table> <tr>
<td>{{ topic.topic_id }}</td>
<td>[{{ topic.getType().value }}] <a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a></td>
<td>{{ topic.name or ""}}</td>
<td><a href="{{ topic.link }}">{{ topic.link | domain }}</a></td>
</tr>
{% endfor %}
</table>
</div>
</div> </div>
{% endif %} {% endif %}

View File

@ -58,6 +58,7 @@ def todo_topics_page():
topics = KrockForumTopic.query \ topics = KrockForumTopic.query \
.filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \ .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \
.order_by(db.asc(KrockForumTopic.title)) \
.all() .all()
return render_template("todo/topics.html", topics=topics, total=total) return render_template("todo/topics.html", topics=topics, total=total)

View File

@ -101,6 +101,7 @@ def user_profile_page(username):
topics_to_add = KrockForumTopic.query \ topics_to_add = KrockForumTopic.query \
.filter_by(author_id=user.id) \ .filter_by(author_id=user.id) \
.filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \ .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \
.order_by(db.asc(KrockForumTopic.title)) \
.all() .all()
# Process GET or invalid POST # Process GET or invalid POST