Skip to content

Commit

Permalink
Add conversations count to feedback icons (#442)
Browse files Browse the repository at this point in the history
* Add conversations count to feedback icons

* Reset the feedback button color when all tasks are completed
  • Loading branch information
Xpirix authored Jul 15, 2024
1 parent d095a5b commit 18ada1e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 14 additions & 3 deletions qgis-app/plugins/templates/plugins/plugin_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,21 @@ <h2>{{ object.name }}
<td>{{ version.created_on|local_timezone }}</td>
{% if user.is_staff or user in version.plugin.approvers or user in version.plugin.editors %}<td><form method="post" action="{% url "version_manage" object.package_name version.version %}">{% csrf_token %}
{% if user.is_staff or user in version.plugin.approvers %}
{% if not version.approved %}<button class="btn btn-success btn-mini" type="submit" name="version_approve" id="version_approve"title="{% trans "Approve" %}"><i class="icon-thumbs-up icon-white"></i></button>{% else %}<button class="btn btn-warning btn-mini" type="submit" name="version_unapprove" id="version_unapprove" title="{% trans "Unapprove" %}"><i class="icon-thumbs-down icon-white"></i></button>{% endif %}
{% if not version.approved %}
<button class="btn btn-success btn-mini" type="submit" name="version_approve" id="version_approve"title="{% trans "Approve" %}">
<i class="icon-thumbs-up icon-white"></i>
</button>
{% else %}
<button class="btn btn-warning btn-mini" type="submit" name="version_unapprove" id="version_unapprove" title="{% trans "Unapprove" %}">
<i class="icon-thumbs-down icon-white"></i></button>
{% endif %}
{% endif %}
<a class="btn {% if version.feedback.exists %}btn-warning{% else %}btn-primary{% endif %} btn-mini"
href="{% url "version_feedback" object.package_name version.version %}" title="{% trans "Feedback" %}"><i class="icon-comments icon-white"></i>
<a class="btn {% if version.feedback|feedbacks_not_completed|length >= 1 %}btn-warning{% else %}btn-primary{% endif %} btn-mini"
href="{% url "version_feedback" object.package_name version.version %}" title="{% trans "Feedback" %}">
<i class="icon-comments icon-white"></i>
{% if version.feedback|feedbacks_not_completed|length >= 2 %}
{{ version.feedback|feedbacks_not_completed|length }}
{% endif %}
</a>
{% if user.is_staff or user in version.plugin.editors %}
<a class="btn btn-primary btn-mini" href="{% url "version_update" object.package_name version.version %}" title="{% trans "Edit" %}"><i class="icon-pencil icon-white"></i></a>&nbsp;<a class="btn btn-danger btn-mini delete" href="{% url "version_delete" object.package_name version.version %}" title="{% trans "Delete" %}"><i class="icon-remove icon-white"></i></a>{% endif %}</form>
Expand Down
4 changes: 4 additions & 0 deletions qgis-app/plugins/templatetags/plugin_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ def _validate_image(file_path):
return True
except (FileNotFoundError, UnidentifiedImageError):
return False

@register.filter
def feedbacks_not_completed(feedbacks):
return feedbacks.filter(is_completed=False)

0 comments on commit 18ada1e

Please sign in to comment.