diff options
| author | rubenwardy <rw@rubenwardy.com> | 2018-06-05 23:45:15 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2018-06-05 23:45:15 +0100 |
| commit | c9542427b41d9223508a64225a4e6e64671b1c22 (patch) | |
| tree | 7962aa5468bd5665e645a953af23b020b6f9e6da /app/templates | |
| parent | 8601c5e075ecd35d4c9f155e8477ad719b41fe3a (diff) | |
| download | cheatdb-c9542427b41d9223508a64225a4e6e64671b1c22.tar.xz | |
Add create links to topic table
Diffstat (limited to 'app/templates')
| -rw-r--r-- | app/templates/macros/topictable.html | 26 | ||||
| -rw-r--r-- | app/templates/todo/topics.html | 21 | ||||
| -rw-r--r-- | app/templates/users/user_profile_page.html | 20 |
3 files changed, 32 insertions, 35 deletions
diff --git a/app/templates/macros/topictable.html b/app/templates/macros/topictable.html new file mode 100644 index 0000000..43324fa --- /dev/null +++ b/app/templates/macros/topictable.html @@ -0,0 +1,26 @@ +{% macro render_topictable(topics, show_author=True) -%} +<table> + <tr> + <th>Id</th> + <th>Title</th> + {% if show_author %}<th>Author</th>{% endif %} + <th>Name</th> + <th>Link</th> + <th>Actions</th> + </tr> + {% for topic in topics %} + <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> + {% if show_author %} + <td><a href="{{ url_for('user_profile_page', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td> + {% endif %} + <td>{{ topic.name or ""}}</td> + <td><a href="{{ topic.link }}">{{ topic.link | domain }}</a></td> + <td> + <a href="{{ url_for('create_edit_package_page', author=topic.author.username, repo=topic.getRepoURL(), forums=topic.topic_id, title=topic.title) }}">Create</a> + </td> + </tr> + {% endfor %} +</table> +{% endmacro %} diff --git a/app/templates/todo/topics.html b/app/templates/todo/topics.html index 77f32c0..f53c4eb 100644 --- a/app/templates/todo/topics.html +++ b/app/templates/todo/topics.html @@ -12,23 +12,6 @@ Topics to be Added {{ topics | count }} remaining. </p> - <table> - <tr> - <th>Id</th> - <th>Title</th> - <th>Author</th> - <th>Name</th> - <th>Link</th> - </tr> - {% for topic in topics %} - <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><a href="{{ url_for('user_profile_page', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td> - <td>{{ topic.name or ""}}</td> - <td><a href="{{ topic.link }}">{{ topic.link | domain }}</a></td> - - </tr> - {% endfor %} - </table> + {% from "macros/topictable.html" import render_topictable %} + {{ render_topictable(topics) }} {% endblock %} diff --git a/app/templates/users/user_profile_page.html b/app/templates/users/user_profile_page.html index 5c5113b..636a610 100644 --- a/app/templates/users/user_profile_page.html +++ b/app/templates/users/user_profile_page.html @@ -108,22 +108,10 @@ Powered by Krock's Mod Search. </p> - <table> - <tr> - <th>Id</th> - <th>Title</th> - <th>Name</th> - <th>Link</th> - </tr> - {% for topic in topics_to_add %} - <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> + + + {% from "macros/topictable.html" import render_topictable %} + {{ render_topictable(topics_to_add, show_author=False) }} </div> </div> {% endif %} |
