2021-01-29 20:38:14 +01:00
|
|
|
{% extends "todo/todo_base.html" %}
|
2018-06-02 19:22:57 +02:00
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
Topics to be Added
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
2018-12-27 16:32:15 +01:00
|
|
|
<div class="float-right">
|
2021-01-30 01:02:40 +01:00
|
|
|
<div class="btn-group btn-group-sm mr-2">
|
|
|
|
<a class="btn btn-secondary {% if sort_by=='date' %}active{% endif %}"
|
2019-11-16 00:51:42 +01:00
|
|
|
href="{{ url_for('todo.topics', q=query, show_discarded=show_discarded, n=n, sort='date') }}">
|
2018-12-25 17:40:19 +01:00
|
|
|
Sort by date
|
|
|
|
</a>
|
2021-01-30 01:02:40 +01:00
|
|
|
<a class="btn btn-secondary {% if sort_by=='name' %}active{% endif %}"
|
2019-11-16 00:51:42 +01:00
|
|
|
href="{{ url_for('todo.topics', q=query, show_discarded=show_discarded, n=n, sort='name') }}">
|
2018-12-25 17:40:19 +01:00
|
|
|
Sort by name
|
|
|
|
</a>
|
2021-01-30 01:02:40 +01:00
|
|
|
<a class="btn btn-secondary {% if sort_by=='views' %}active{% endif %}"
|
2019-11-16 00:51:42 +01:00
|
|
|
href="{{ url_for('todo.topics', q=query, show_discarded=show_discarded, n=n, sort='views') }}">
|
2018-12-27 16:32:15 +01:00
|
|
|
Sort by views
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
2021-01-30 01:02:40 +01:00
|
|
|
<div class="btn-group btn-group-sm">
|
2021-08-16 19:57:05 +02:00
|
|
|
{% if current_user.rank.atLeast(current_user.rank.APPROVER) %}
|
2018-12-27 16:32:15 +01:00
|
|
|
{% if n >= 10000 %}
|
2021-01-30 01:02:40 +01:00
|
|
|
<a class="btn btn-secondary"
|
2019-11-16 00:51:42 +01:00
|
|
|
href="{{ url_for('todo.topics', q=query, show_discarded=show_discarded, n=100, sort=sort_by) }}">
|
2018-12-27 16:32:15 +01:00
|
|
|
Paginated list
|
|
|
|
</a>
|
|
|
|
{% else %}
|
2021-01-30 01:02:40 +01:00
|
|
|
<a class="btn btn-secondary"
|
2019-11-16 00:51:42 +01:00
|
|
|
href="{{ url_for('todo.topics', q=query, show_discarded=show_discarded, n=10000, sort=sort_by) }}">
|
2018-12-27 16:32:15 +01:00
|
|
|
Unlimited list
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
2018-12-25 16:20:58 +01:00
|
|
|
{% endif %}
|
2018-12-24 00:49:49 +01:00
|
|
|
|
2021-01-30 01:02:40 +01:00
|
|
|
<a class="btn btn-secondary" href="{{ url_for('todo.topics', q=query, show_discarded=not show_discarded, n=n, sort=sort_by) }}">
|
2018-12-27 16:32:15 +01:00
|
|
|
{% if not show_discarded %}
|
|
|
|
Show
|
|
|
|
{% else %}
|
|
|
|
Hide
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
discarded topics
|
|
|
|
</a>
|
|
|
|
</div>
|
2018-12-25 16:20:58 +01:00
|
|
|
</div>
|
2018-12-24 00:49:49 +01:00
|
|
|
|
2018-06-02 19:22:57 +02:00
|
|
|
<h1>Topics to be Added</h1>
|
|
|
|
|
2019-11-16 01:05:35 +01:00
|
|
|
{% if topic_count > 0 %}
|
|
|
|
<p>
|
|
|
|
{{ total - topic_count }} / {{ total }} topics have been added as packages to CDB.
|
|
|
|
{{ topic_count }} remaining.
|
|
|
|
</p>
|
|
|
|
<div class="progress">
|
|
|
|
{% set perc = 100 * (total - topic_count) / total %}
|
|
|
|
<div class="progress-bar bg-success" role="progressbar"
|
|
|
|
style="width: {{ perc }}%" aria-valuenow="{{ perc }}" aria-valuemin="0" aria-valuemax="100"></div>
|
2020-01-22 23:10:02 +01:00
|
|
|
</div>
|
2019-11-16 01:05:35 +01:00
|
|
|
{% else %}
|
|
|
|
<p>
|
|
|
|
The forum topic crawler needs to run at least once for this section to work.
|
|
|
|
</p>
|
|
|
|
{% endif %}
|
2018-06-02 19:22:57 +02:00
|
|
|
|
2019-11-16 00:51:42 +01:00
|
|
|
<form method="GET" action="{{ url_for('todo.topics') }}" class="my-4">
|
2018-12-25 19:10:31 +01:00
|
|
|
<input type="hidden" name="show_discarded" value={{ show_discarded and "True" or "False" }} />
|
|
|
|
<input type="hidden" name="n" value={{ n }} />
|
|
|
|
<input type="hidden" name="sort" value={{ sort_by or "date" }} />
|
|
|
|
<input name="q" type="text" placeholder="Search topics" value="{{ query or ''}}">
|
2018-12-23 19:03:23 +01:00
|
|
|
<input class="btn btn-secondary my-2 my-sm-0 mr-sm-2" type="submit" value="Search" />
|
|
|
|
</form>
|
|
|
|
|
2018-08-25 19:20:45 +02:00
|
|
|
{% from "macros/topics.html" import render_topics_table %}
|
2018-12-25 18:51:29 +01:00
|
|
|
{{ render_topics_table(topics, show_discard=True, current_user=current_user) }}
|
2018-12-23 19:03:23 +01:00
|
|
|
|
|
|
|
<ul class="pagination mt-4">
|
|
|
|
<li class="page-item {% if not prev_url %}disabled{% endif %}">
|
|
|
|
<a class="page-link" {% if prev_url %}href="{{ prev_url }}"{% endif %}>«</a>
|
|
|
|
</li>
|
2018-12-25 19:10:31 +01:00
|
|
|
{% for i in range(1, page_max+1) %}
|
|
|
|
<li class="page-item {% if i == page %}active{% endif %}">
|
2018-12-23 19:03:23 +01:00
|
|
|
<a class="page-link"
|
2019-11-16 00:51:42 +01:00
|
|
|
href="{{ url_for('todo.topics', page=i, query=query, show_discarded=show_discarded, n=n, sort=sort_by) }}">
|
2018-12-25 19:10:31 +01:00
|
|
|
{{ i }}
|
2018-12-23 19:03:23 +01:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
<li class="page-item {% if not next_url %}disabled{% endif %}">
|
|
|
|
<a class="page-link" {% if next_url %}href="{{ next_url }}"{% endif %}>»</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2018-06-02 19:22:57 +02:00
|
|
|
{% endblock %}
|
2018-12-24 00:49:49 +01:00
|
|
|
|
|
|
|
{% block scriptextra %}
|
|
|
|
<script>
|
2020-12-04 03:34:08 +01:00
|
|
|
const csrf_token = "{{ csrf_token() }}";
|
2018-12-24 00:49:49 +01:00
|
|
|
</script>
|
2018-12-25 18:51:29 +01:00
|
|
|
<script src="/static/topic_discard.js"></script>
|
2018-12-24 00:49:49 +01:00
|
|
|
{% endblock %}
|