]> git.lizzy.rs Git - cheatdb.git/commitdiff
Add WIP forum topic support
authorrubenwardy <rw@rubenwardy.com>
Fri, 6 Jul 2018 22:15:56 +0000 (23:15 +0100)
committerrubenwardy <rw@rubenwardy.com>
Fri, 6 Jul 2018 22:17:56 +0000 (23:17 +0100)
app/models.py
app/scss/components.scss
app/tasks/forumtasks.py
app/templates/macros/topictable.html
app/templates/packages/view.html
app/templates/todo/list.html
app/templates/users/user_profile_page.html
app/views/packages/todo.py
migrations/versions/9e2ac631efb0_.py [new file with mode: 0644]

index 338b4f0bf7abc274b281c2a7d2d19a964928bdab..39a86478020c862d8356244230cc33f336bcfe38 100644 (file)
@@ -768,6 +768,8 @@ class ForumTopic(db.Model):
        author_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
        author    = db.relationship("User")
 
+       wip       = db.Column(db.Boolean, server_default="0")
+
        type      = db.Column(db.Enum(PackageType), nullable=False)
        title     = db.Column(db.String(200), nullable=False)
        name      = db.Column(db.String(30), nullable=True)
index aac5e26bcad20a343befb77e9cea09b9e80df089..a90a510a14ff0022d57970fd3d76161291e62ca8 100644 (file)
@@ -451,3 +451,7 @@ table.fancyTable tfoot td {
 .table-topalign td {
        vertical-align: top;
 }
+
+.wiptopic a {
+       color: #7ac;
+}
index 5513fb2b4cddf79cff5b02588c588687bb6c9c31..338ffa28a3954c3f42dc19c2d5091b57fe498bf1 100644 (file)
@@ -87,8 +87,10 @@ def importTopicList():
        links_by_id = getLinksFromModSearch()
 
        info_by_id = {}
-       getTopicsFromForum(11, out=info_by_id, extra={ 'type': PackageType.MOD })
-       getTopicsFromForum(15, out=info_by_id, extra={ 'type': PackageType.GAME })
+       getTopicsFromForum(11, out=info_by_id, extra={ 'type': PackageType.MOD,  'wip': False })
+       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
        username_to_user = {}
@@ -131,6 +133,7 @@ def importTopicList():
                topic.title      = title
                topic.name       = name
                topic.link       = link
+               topic.wip        = info["wip"]
                topic.posts      = info["posts"]
                topic.views      = info["views"]
                topic.created_at = info["date"]
index 7ae8a3596ebcc8d66c56d227203a394bcce4f558..8a6b31c4e1480fd779c28106cee719b5fe656de5 100644 (file)
@@ -2,6 +2,7 @@
 <table>
        <tr>
                <th>Id</th>
+               <th></th>
                <th>Title</th>
                {% if show_author %}<th>Author</th>{% endif %}
                <th>Name</th>
@@ -9,9 +10,15 @@
                <th>Actions</th>
        </tr>
        {% for topic in topics %}
-               <tr>
+               <tr{% if topic.wip %} class="wiptopic"{% endif %}>
                        <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 %}
                                <td><a href="{{ url_for('user_profile_page', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td>
                        {% endif %}
index f69b5cfc78eb0bdfe46e78bf9c849f7568025d32..df31ce1c0454ce1e5d0bed3093b0d8d393787d9f 100644 (file)
                                        <a href="https://forum.minetest.net/viewtopic.php?t={{ t.topic_id }}">
                                                {{ t.title }} by {{ t.author.display_name }}
                                        </a>
+                                       {% if t.wip %}[WIP]{% endif %}
                                </li>
                        {% endfor %}
                </ul>
index f2172a6494132cfe23752d53e40dfc18e2034d5a..5e50c2e2769b8778bf8440665ef5c0ccef21c6bd 100644 (file)
@@ -65,6 +65,6 @@
        <p>
                There are
                <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>
 {% endblock %}
index 636a61006e151437db38c9876d14bd6e64d9ee04..81b5934733d7cf43dbb49622ef50df0b5d27feb2 100644 (file)
 
                <div class="box-body">
                        <p>
-                               List of your topics without a matching package.
-                               Powered by Krock's Mod Search.
+                               List of your forum topics which do not have a matching package.
                        </p>
 
-                       
-
                        {% from "macros/topictable.html" import render_topictable %}
                        {{ render_topictable(topics_to_add, show_author=False) }}
                </div>
index 84cfef4f517ebf11d0c80134f521bfef780052ff..314c3741bda378c4402dcb2315b25dcb926ec6ff 100644 (file)
@@ -58,7 +58,7 @@ def todo_topics_page():
 
        topics = ForumTopic.query \
                        .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()
 
        return render_template("todo/topics.html", topics=topics, total=total)
diff --git a/migrations/versions/9e2ac631efb0_.py b/migrations/versions/9e2ac631efb0_.py
new file mode 100644 (file)
index 0000000..1b10d0e
--- /dev/null
@@ -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 ###