Add missing tags section to user todo list

This commit is contained in:
rubenwardy 2021-01-30 16:03:09 +00:00
parent 82fe0e7bbf
commit 663cbd91f5
4 changed files with 39 additions and 15 deletions

@ -17,6 +17,7 @@
from flask import *
from flask_login import current_user, login_required
from sqlalchemy import or_
from sqlalchemy.sql.operators import is_
from app.models import *
from app.querybuilder import QueryBuilder
@ -166,9 +167,13 @@ def view_user(username=None):
.order_by(db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \
.all()
needs_tags = user.maintained_packages \
.filter(Package.state != PackageState.APPROVED) \
.filter_by(tags=None).order_by(db.asc(Package.title)).all()
return render_template("todo/user.html", current_tab="user", user=user,
unapproved_packages=unapproved_packages, outdated_packages=outdated_packages,
topics_to_add=topics_to_add)
needs_tags=needs_tags, topics_to_add=topics_to_add)
@bp.route("/todo/outdated/")

@ -1,7 +1,7 @@
{% extends "todo/todo_base.html" %}
{% block title %}
{{ _("All Package Tags") }}
{{ _("Package Tags") }}
{% endblock %}
{% block content %}

@ -26,7 +26,7 @@
<li class="nav-item">
<a class="nav-link {% if current_tab == "tags" %}active{% endif %}"
href="{{ url_for('todo.tags') }}">
{{ _("All Package Tags") }}
{{ _("Package Tags") }}
</a>
</li>
<li class="nav-item">

@ -10,7 +10,6 @@
{% 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"
@ -21,7 +20,6 @@
{{ package.title }}
</span>
</div>
{% endif %}
<div class="col-sm">
State: {{ package.state.value }}
@ -29,7 +27,7 @@
</div>
</a>
{% else %}
<p class="list-group-item"><i>{{ _("Nothing to do :)") }}</i></p>
<p class="text-muted">{{ _("Nothing to do :)") }}</p>
{% endfor %}
</div>
@ -51,6 +49,27 @@
{% from "macros/todo.html" import render_outdated_packages %}
{{ render_outdated_packages(outdated_packages, current_user) }}
<div class="mt-5"></div>
<a class="btn btn-secondary float-right" href="{{ url_for('todo.tags', author=user.username) }}">See All</a>
<h2>{{ _("Packages Without Tags") }}</h2>
<div class="list-group mt-3 mb-5">
{% for package in needs_tags %}
<a class="list-group-item list-group-item-action" href="{{ package.getDetailsURL() }}">
<img
class="img-fluid"
style="max-height: 22px; max-width: 22px;"
src="{{ package.getThumbnailOrPlaceholder() }}" />
<span class="pl-2">
{{ package.title }}
</span>
</a>
{% else %}
<p class="text-muted">{{ _("Nothing to do :)") }}</p>
{% endfor %}
</div>
<h2 class="mt-5">{{ _("Unadded Topics") }}</h2>
{% if topics_to_add %}
<p>