Add new to do list UI

This commit is contained in:
rubenwardy
2021-01-29 19:38:14 +00:00
parent b613ac4b89
commit 4f920f011f
14 changed files with 299 additions and 110 deletions

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% extends "todo/todo_base.html" %}
{% block title %}
{{ title }}
{{ _("Editor Work Queue") }}
{% endblock %}
{% block content %}
@@ -9,7 +9,7 @@
{% if canApproveScn and screenshots %}
<div class="card my-4">
<h3 class="card-header">Screenshots
<form class="float-right" method="post" action="{{ url_for('todo.view') }}">
<form class="float-right" method="post" action="{{ url_for('todo.view_editor') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="hidden" name="action" value="screenshots_approve_all" />
<input class="btn btn-sm btn-primary" type="submit" value="Approve All" />
@@ -68,31 +68,6 @@
{% endfor %}
</div>
</div>
<div class="card mt-5">
<h3 class="card-header">WIP Packages</h3>
<div class="list-group list-group-flush" style="max-height: 300px; overflow: hidden auto;">
{% for p in wip_packages %}
<a href="{{ p.getDetailsURL() }}" class="list-group-item list-group-item-action">
<span class="float-right" title="Created {{ p.created_at | datetime }}">
<small>
{{ p.created_at | timedelta }} ago
</small>
</span>
{% if p.state == p.state.WIP %}
<span class="mr-2 badge badge-warning">WIP</span>
{% else %}
<span class="mr-2 badge badge-danger">{{ p.state.value }}</span>
{% endif %}
{{ p.title }} by {{ p.author.display_name }}
</a>
{% else %}
<li class="list-group-item"><i>No packages need reviewing.</i></li>
{% endfor %}
</div>
</div>
</div>
{% endif %}
@@ -157,24 +132,46 @@
{% endif %}
<h2 class="mt-5">Unadded Topic List</h2>
<h2 class="mt-5">{{ _("Outdated packages") }}</h2>
{% if total_topics > 0 %}
{% if outdated_packages > 0 %}
<p>
{{ total_topics - topics_to_add }} / {{ total_topics }} packages have been been added to cdb,
based on cdb's forum parser. {{ topics_to_add }} remaining.
{{ _("There are %(count)s potentially outdated packages packages", count=outdated_packages) }}
</p>
<div class="progress my-4">
{% set perc = 100 * (total_topics - topics_to_add) / total_topics %}
<div class="progress-bar bg-success" role="progressbar"
style="width: {{ perc }}%" aria-valuenow="{{ perc }}" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<a class="btn btn-primary" href="{{ url_for('todo.topics') }}">View Unadded Topic List</a>
<a class="btn btn-primary" href="{{ url_for('todo.outdated') }}">{{ _("View Outdated") }}</a>
{% else %}
<p>
The forum topic crawler needs to run at least once for this section to work.
<i>{{ _("No outdated packages") }}</i>
</p>
{% endif %}
<h2 class="mt-5">WIP</h2>
{% if canApproveNew and (packages or wip_packages) %}
<div class="card">
<h3 class="card-header">WIP Packages</h3>
<div class="list-group list-group-flush" style="max-height: 300px; overflow: hidden auto;">
{% for p in wip_packages %}
<a href="{{ p.getDetailsURL() }}" class="list-group-item list-group-item-action">
<span class="float-right" title="Created {{ p.created_at | datetime }}">
<small>
{{ p.created_at | timedelta }} ago
</small>
</span>
{% if p.state == p.state.WIP %}
<span class="mr-2 badge badge-warning">WIP</span>
{% else %}
<span class="mr-2 badge badge-danger">{{ p.state.value }}</span>
{% endif %}
{{ p.title }} by {{ p.author.display_name }}
</a>
{% else %}
<li class="list-group-item"><i>No packages need reviewing.</i></li>
{% endfor %}
</div>
</div>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,12 @@
{% extends "todo/todo_base.html" %}
{% block title %}
{{ _("Outdated packages") }}
{% endblock %}
{% block content %}
<h2>{{ self.title() }}</h2>
{% from "macros/todo.html" import render_outdated_packages %}
{{ render_outdated_packages(outdated_packages) }}
{% endblock %}

View File

@@ -0,0 +1,44 @@
{% extends "base.html" %}
{% block container %}
{% if current_user.rank.atLeast(current_user.rank.EDITOR) %}
<nav class="pt-4 tabs-container">
<div class="container">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link {% if current_tab == "user" %}active{% endif %}"
href="{{ url_for('todo.view_user', username=current_user.username) }}">
{{ _("%(username)s's to do list", username=current_user.display_name) }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_tab == "editor" %}active{% endif %}"
href="{{ url_for('todo.view_editor') }}">
{{ _("Editor Work Queue") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_tab == "outdated" %}active{% endif %}"
href="{{ url_for('todo.outdated') }}">
{{ _("All Outdated Packages") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_tab == "topics" %}active{% endif %}"
href="{{ url_for('todo.topics') }}">
{{ _("Topics") }}
</a>
</li>
</ul>
</div>
</nav>
{% endif %}
<main class="container mt-5">
{% if not current_user.rank.atLeast(current_user.rank.EDITOR) %}
<h1 class="mb-5">{{ self.title() }}</h1>
{% endif %}
{{ self.content() }}
</main>
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "todo/todo_base.html" %}
{% block title %}
Topics to be Added

View File

@@ -0,0 +1,64 @@
{% extends "todo/todo_base.html" %}
{% block title %}
{{ _("%(username)s's to do list", username=user.display_name) }}
{% endblock %}
{% block content %}
<h2>{{ _("Unapproved Packages Needing Action") }}</h2>
<div class="list-group mt-3">
{% for package in unapproved_packages %}
<a class="list-group-item list-group-item-action" href="{{ package.getDetailsURL() }}">
<div class="row">
{% if package %}
<div class="col-sm-2 text-muted">
<img
class="img-fluid"
style="max-height: 22px; max-width: 22px;"
src="{{ package.getThumbnailURL(1) }}" />
<span class="pl-2">
{{ package.title }}
</span>
</div>
{% endif %}
<div class="col-sm">
State: {{ package.state.value }}
</div>
</div>
</a>
{% else %}
<p class="list-group-item"><i>No outdated packages.</i></p>
{% endfor %}
</div>
<h2 class="mt-5">{{ _("Outdated Packages") }}</h2>
{% from "macros/todo.html" import render_outdated_packages %}
{{ render_outdated_packages(outdated_packages) }}
<h2 class="mt-5">{{ _("Unadded Topics") }}</h2>
{% if topics_to_add %}
<p>
List of your forum topics which do not have a matching package.
Topics with a strikethrough have been marked as discarded.
</p>
<div style="max-height: 20em; overflow-y: auto">
{% from "macros/topics.html" import render_topics_table %}
{{ render_topics_table(topics_to_add, show_author=False, show_discard=True, current_user=current_user) }}
</div>
{% else %}
<p class="card-body">Congrats! You don't have any topics which aren't on CDB.</p>
{% endif %}
{% endblock %}
{% block scriptextra %}
<script>
const csrf_token = "{{ csrf_token() }}";
</script>
<script src="/static/topic_discard.js"></script>
{% endblock %}