Skip to content

Commit

Permalink
Show Version's stats along with Artifact's stats in artifact detail page
Browse files Browse the repository at this point in the history
The artifact details page shows version's stats which is confusing as the list page shows artifac's stats and the details page shows different numbers

Also update tool tip for artifact to show 'last updated' and for version stats to show 'created_at'
  • Loading branch information
AnishReddyRavula committed Oct 2, 2023
1 parent 88f0b02 commit 697541f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
9 changes: 8 additions & 1 deletion sharing_portal/templates/sharing_portal/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ <h2 class="artifactTitle">
{{ artifact.long_description|markdown|safe }}
</section>

{% include 'sharing_portal/includes/stats.html' with artifact=artifact version=version %}
<section class="artifactBody__authors">
<h4>Artifact stats</h4>
{% include 'sharing_portal/includes/stats.html' with artifact=artifact version=None %}
</section>

{% if artifact.authors %}
<section class="artifactBody__authors">
Expand Down Expand Up @@ -146,6 +149,10 @@ <h4><i class="fa fa-files-o"></i> Versions</h4>
{% endfor %}
</ol>
</div>
<h4>Version Stats</h4>
<div style="margin-left: 0.5em">
{% include 'sharing_portal/includes/stats.html' with artifact=artifact version=version sidebar=True %}
</div>
</div>
</div>
{% endblock %}
26 changes: 14 additions & 12 deletions sharing_portal/templates/sharing_portal/includes/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@
{% load trovi_filters %}
<span class="artifactStats__updated">{{ artifact.updated_at | trovi_date_format }}</span>
</div>
<div class="artifactStats__labels">
{% for label in artifact.tags %}
<a href="{% url 'sharing_portal:index_all' %}?filter=tag:{{ label|urlencode }}">{{ label }}</a>
{% endfor %}
{% for badge in artifact.badges %}
<a href="{% url 'sharing_portal:index_all' %}?filter=badge:{{ badge.badge.name|urlencode }}" class="artifactStats__chameleonSupported" title="{{badge.badge.description}}">
{% with 'images/'|add:badge.badge.name|add:'-logo-small.png' as logo_static %}
<img src="{% static logo_static %}" alt="Small {{badge.badge.name}} logo">
{% endwith %}
</a>
{% endfor %}
{% if not sidebar %}
<div class="artifactStats__labels">
{% for label in artifact.tags %}
<a href="{% url 'sharing_portal:index_all' %}?filter=tag:{{ label|urlencode }}">{{ label }}</a>
{% endfor %}
{% for badge in artifact.badges %}
<a href="{% url 'sharing_portal:index_all' %}?filter=badge:{{ badge.badge.name|urlencode }}" class="artifactStats__chameleonSupported" title="{{badge.badge.description}}">
{% with 'images/'|add:badge.badge.name|add:'-logo-small.png' as logo_static %}
<img src="{% static logo_static %}" alt="Small {{badge.badge.name}} logo">
{% endwith %}
</a>
{% endfor %}

</div>
</div>
{% endif %}
</div>

0 comments on commit 697541f

Please sign in to comment.