Only show labels which haven't been linked yet

...in the dropbox for adding new labels to a ticket.
This commit is contained in:
Ivan Habunek 2018-10-15 13:18:53 +02:00 committed by Drew DeVault
parent 5730d360aa
commit aba4f78345
2 changed files with 6 additions and 2 deletions

View File

@ -57,8 +57,12 @@ def ticket_GET(owner, name, ticket_id):
is_subscribed = bool(sub)
ticket_labels = TicketLabel.query.filter(TicketLabel.ticket_id == ticket.id)
labels = [tl.label for tl in ticket_labels]
return render_template("ticket.html", tracker=tracker, ticket=ticket,
access=access, is_subscribed=is_subscribed, tracker_sub=tracker_sub)
access=access, is_subscribed=is_subscribed, tracker_sub=tracker_sub,
labels=labels)
@ticket.route("/<owner>/<name>/<int:ticket_id>/enable_notifications", methods=["POST"])
@loginrequired

View File

@ -148,7 +148,7 @@
}}">
<select id="label_id" name="label_id">
<option>-- Pick one --</option>
{% for label in tracker.labels %}
{% for label in tracker.labels if label not in labels %}
<option value="{{ label.id }}">
{{ label.name }}
</option>