aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/templates/todo/topics.html29
-rw-r--r--app/views/packages/todo.py8
2 files changed, 28 insertions, 9 deletions
diff --git a/app/templates/todo/topics.html b/app/templates/todo/topics.html
index bec0f42..2156e8d 100644
--- a/app/templates/todo/topics.html
+++ b/app/templates/todo/topics.html
@@ -5,15 +5,30 @@ Topics to be Added
{% endblock %}
{% block content %}
- <a class="btn btn-primary float-right" href="{{ url_for('todo_topics_page', q=query, show_discarded=not show_discarded) }}">
- {% if not show_discarded %}
- Show
- {% else %}
- Hide
+ <div class="float-right btn-group">
+ {% if current_user.rank.atLeast(current_user.rank.EDITOR) %}
+ {% if n >= 10000 %}
+ <a class="btn btn-primary"
+ href="{{ url_for('todo_topics_page', q=query, show_discarded=show_discarded, n=100) }}">
+ Paginiated List
+ </a>
+ {% else %}
+ <a class="btn btn-primary"
+ href="{{ url_for('todo_topics_page', q=query, show_discarded=show_discarded, n=10000) }}">
+ Unlimited List
+ </a>
+ {% endif %}
{% endif %}
+ <a class="btn btn-primary" href="{{ url_for('todo_topics_page', q=query, show_discarded=not show_discarded) }}">
+ {% if not show_discarded %}
+ Show
+ {% else %}
+ Hide
+ {% endif %}
- Discarded Topics
- </a>
+ Discarded Topics
+ </a>
+ </div>
<h1>Topics to be Added</h1>
diff --git a/app/views/packages/todo.py b/app/views/packages/todo.py
index a29a46e..baca000 100644
--- a/app/views/packages/todo.py
+++ b/app/views/packages/todo.py
@@ -72,7 +72,10 @@ def todo_topics_page():
query = query.filter(ForumTopic.title.ilike('%' + search + '%'))
page = int(request.args.get("page") or 1)
- num = min(100, int(request.args.get("n") or 100))
+ num = int(request.args.get("n") or 100)
+ if num > 100 and not current_user.rank.atLeast(UserRank.EDITOR):
+ num = 100
+
query = query.paginate(page, num, True)
next_url = url_for("todo_topics_page", page=query.next_num) \
if query.has_next else None
@@ -81,4 +84,5 @@ def todo_topics_page():
return render_template("todo/topics.html", topics=query.items, total=total, \
topic_count=topic_count, query=search, show_discarded=show_discarded, \
- next_url=next_url, prev_url=prev_url, page=page, page_max=query.pages)
+ next_url=next_url, prev_url=prev_url, page=page, page_max=query.pages, \
+ n=num)