mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Add WIP forum topic support
This commit is contained in:
parent
9dd3570a52
commit
67a229b8a3
@ -768,6 +768,8 @@ class ForumTopic(db.Model):
|
|||||||
author_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
|
author_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
|
||||||
author = db.relationship("User")
|
author = db.relationship("User")
|
||||||
|
|
||||||
|
wip = db.Column(db.Boolean, server_default="0")
|
||||||
|
|
||||||
type = db.Column(db.Enum(PackageType), nullable=False)
|
type = db.Column(db.Enum(PackageType), nullable=False)
|
||||||
title = db.Column(db.String(200), nullable=False)
|
title = db.Column(db.String(200), nullable=False)
|
||||||
name = db.Column(db.String(30), nullable=True)
|
name = db.Column(db.String(30), nullable=True)
|
||||||
|
@ -451,3 +451,7 @@ table.fancyTable tfoot td {
|
|||||||
.table-topalign td {
|
.table-topalign td {
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wiptopic a {
|
||||||
|
color: #7ac;
|
||||||
|
}
|
||||||
|
@ -87,8 +87,10 @@ def importTopicList():
|
|||||||
links_by_id = getLinksFromModSearch()
|
links_by_id = getLinksFromModSearch()
|
||||||
|
|
||||||
info_by_id = {}
|
info_by_id = {}
|
||||||
getTopicsFromForum(11, out=info_by_id, extra={ 'type': PackageType.MOD })
|
getTopicsFromForum(11, out=info_by_id, extra={ 'type': PackageType.MOD, 'wip': False })
|
||||||
getTopicsFromForum(15, out=info_by_id, extra={ 'type': PackageType.GAME })
|
getTopicsFromForum(9, out=info_by_id, extra={ 'type': PackageType.MOD, 'wip': True })
|
||||||
|
getTopicsFromForum(15, out=info_by_id, extra={ 'type': PackageType.GAME, 'wip': False })
|
||||||
|
getTopicsFromForum(50, out=info_by_id, extra={ 'type': PackageType.GAME, 'wip': True })
|
||||||
|
|
||||||
# Caches
|
# Caches
|
||||||
username_to_user = {}
|
username_to_user = {}
|
||||||
@ -131,6 +133,7 @@ def importTopicList():
|
|||||||
topic.title = title
|
topic.title = title
|
||||||
topic.name = name
|
topic.name = name
|
||||||
topic.link = link
|
topic.link = link
|
||||||
|
topic.wip = info["wip"]
|
||||||
topic.posts = info["posts"]
|
topic.posts = info["posts"]
|
||||||
topic.views = info["views"]
|
topic.views = info["views"]
|
||||||
topic.created_at = info["date"]
|
topic.created_at = info["date"]
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>Id</th>
|
||||||
|
<th></th>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
{% if show_author %}<th>Author</th>{% endif %}
|
{% if show_author %}<th>Author</th>{% endif %}
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
@ -9,9 +10,15 @@
|
|||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for topic in topics %}
|
{% for topic in topics %}
|
||||||
<tr>
|
<tr{% if topic.wip %} class="wiptopic"{% endif %}>
|
||||||
<td>{{ topic.topic_id }}</td>
|
<td>{{ topic.topic_id }}</td>
|
||||||
<td>[{{ topic.type.value }}] <a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a></td>
|
<td>
|
||||||
|
[{{ topic.type.value }}]
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
|
||||||
|
{% if topic.wip %}[WIP]{% endif %}
|
||||||
|
</td>
|
||||||
{% if show_author %}
|
{% if show_author %}
|
||||||
<td><a href="{{ url_for('user_profile_page', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td>
|
<td><a href="{{ url_for('user_profile_page', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -296,6 +296,7 @@
|
|||||||
<a href="https://forum.minetest.net/viewtopic.php?t={{ t.topic_id }}">
|
<a href="https://forum.minetest.net/viewtopic.php?t={{ t.topic_id }}">
|
||||||
{{ t.title }} by {{ t.author.display_name }}
|
{{ t.title }} by {{ t.author.display_name }}
|
||||||
</a>
|
</a>
|
||||||
|
{% if t.wip %}[WIP]{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -65,6 +65,6 @@
|
|||||||
<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, based on forum topics picked up by Krock's mod search.
|
to be added to cdb, based on cdb's forum parser.
|
||||||
</p>
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -104,12 +104,9 @@
|
|||||||
|
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<p>
|
<p>
|
||||||
List of your topics without a matching package.
|
List of your forum topics which do not have a matching package.
|
||||||
Powered by Krock's Mod Search.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% from "macros/topictable.html" import render_topictable %}
|
{% from "macros/topictable.html" import render_topictable %}
|
||||||
{{ render_topictable(topics_to_add, show_author=False) }}
|
{{ render_topictable(topics_to_add, show_author=False) }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -58,7 +58,7 @@ def todo_topics_page():
|
|||||||
|
|
||||||
topics = ForumTopic.query \
|
topics = ForumTopic.query \
|
||||||
.filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \
|
.filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \
|
||||||
.order_by(db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \
|
.order_by(db.asc(ForumTopic.wip), db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \
|
||||||
.all()
|
.all()
|
||||||
|
|
||||||
return render_template("todo/topics.html", topics=topics, total=total)
|
return render_template("todo/topics.html", topics=topics, total=total)
|
||||||
|
28
migrations/versions/9e2ac631efb0_.py
Normal file
28
migrations/versions/9e2ac631efb0_.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 9e2ac631efb0
|
||||||
|
Revises: 11b6ef362f98
|
||||||
|
Create Date: 2018-07-06 23:16:50.507010
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '9e2ac631efb0'
|
||||||
|
down_revision = '11b6ef362f98'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('forum_topic', sa.Column('wip', sa.Boolean(), nullable=False, server_default="0"))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('forum_topic', 'wip')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user