diff options
| author | rubenwardy <rw@rubenwardy.com> | 2018-08-25 18:20:45 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2018-08-25 18:20:45 +0100 |
| commit | 36000b159273d06aba3fb56eab2cd78099b7e54a (patch) | |
| tree | 57a7289704b2cb9d455deb10862dfd146b20c0b2 /app/templates | |
| parent | b296b9b299fa4d07bedc25c791d1a039d4b9fb72 (diff) | |
| download | cheatdb-36000b159273d06aba3fb56eab2cd78099b7e54a.tar.xz | |
Add list of relevant forum topics to last page of results
Diffstat (limited to 'app/templates')
| -rw-r--r-- | app/templates/macros/topics.html (renamed from app/templates/macros/topictable.html) | 21 | ||||
| -rw-r--r-- | app/templates/packages/list.html | 8 | ||||
| -rw-r--r-- | app/templates/todo/topics.html | 4 | ||||
| -rw-r--r-- | app/templates/users/user_profile_page.html | 4 |
4 files changed, 32 insertions, 5 deletions
diff --git a/app/templates/macros/topictable.html b/app/templates/macros/topics.html index 8a6b31c..0e01185 100644 --- a/app/templates/macros/topictable.html +++ b/app/templates/macros/topics.html @@ -1,4 +1,4 @@ -{% macro render_topictable(topics, show_author=True) -%} +{% macro render_topics_table(topics, show_author=True) -%} <table> <tr> <th>Id</th> @@ -31,3 +31,22 @@ {% endfor %} </table> {% endmacro %} + + +{% macro render_topics(topics, current_user, show_author=True) -%} +<ul> + {% for topic in topics %} + <li{% if topic.wip %} class="wiptopic"{% endif %}> + <a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a> + {% if topic.wip %}[WIP]{% endif %} + {% if topic.name %}[{{ topic.name }}]{% endif %} + {% if show_author %} + by <a href="{{ url_for('user_profile_page', username=topic.author.username) }}">{{ topic.author.display_name }}</a> + {% endif %} + {% if not topic.author.checkPerm(current_user, "CHANGE_AUTHOR") %} + <a href="{{ url_for('create_edit_package_page', author=topic.author.username, repo=topic.getRepoURL(), forums=topic.topic_id, title=topic.title, bname=topic.name) }}">Create</a> + {% endif %} + </li> + {% endfor %} +</ul> +{% endmacro %} diff --git a/app/templates/packages/list.html b/app/templates/packages/list.html index 0ce5c90..53ffac0 100644 --- a/app/templates/packages/list.html +++ b/app/templates/packages/list.html @@ -37,4 +37,12 @@ <li>{{ page }} / {{ page_max }}</li> {% if next_url %}<li><a href="{{ next_url }}">Next</a></li> {% endif %} </ul> + + {% if topics %} + <h2 style="margin-top:2em;">More content from the forums</h2> + + {% from "macros/topics.html" import render_topics %} + {{ render_topics(topics, current_user) }} + {% endif %} + {% endblock %} diff --git a/app/templates/todo/topics.html b/app/templates/todo/topics.html index f53c4eb..74a9381 100644 --- a/app/templates/todo/topics.html +++ b/app/templates/todo/topics.html @@ -12,6 +12,6 @@ Topics to be Added {{ topics | count }} remaining. </p> - {% from "macros/topictable.html" import render_topictable %} - {{ render_topictable(topics) }} + {% from "macros/topics.html" import render_topics_table %} + {{ render_topics_table(topics) }} {% endblock %} diff --git a/app/templates/users/user_profile_page.html b/app/templates/users/user_profile_page.html index 81b5934..1120849 100644 --- a/app/templates/users/user_profile_page.html +++ b/app/templates/users/user_profile_page.html @@ -107,8 +107,8 @@ 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) }} + {% from "macros/topics.html" import render_topics_table %} + {{ render_topics_table(topics_to_add, show_author=False) }} </div> </div> {% endif %} |
