From 13d296e68161ceedd1c104aa07098ffb2793ccec Mon Sep 17 00:00:00 2001 From: Brian Perrett Date: Mon, 30 Sep 2024 16:29:48 -0700 Subject: [PATCH] New contributor visual changes. --- libraries/views.py | 20 ++++++++------------ templates/libraries/detail.html | 8 +++++++- templates/partials/avatar.html | 11 ----------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/libraries/views.py b/libraries/views.py index fa403646..7df4897c 100644 --- a/libraries/views.py +++ b/libraries/views.py @@ -271,33 +271,29 @@ def get_context_data(self, **kwargs): for x in context["maintainers"] if getattr(x.commitauthor, "id", None) ] - context["top_contributors_release"] = self.get_top_contributors( + top_contributors_release = self.get_top_contributors( version=context["version"], exclude=exclude_maintainer_ids, ) - exclude_top_contributor_ids = [ - x.id for x in context["top_contributors_release"] + context["top_contributors_release_new"] = [ + x for x in top_contributors_release if x.is_new ] + context["top_contributors_release_old"] = [ + x for x in top_contributors_release if not x.is_new + ] + exclude_top_contributor_ids = [x.id for x in top_contributors_release] context["top_contributors_overall"] = self.get_top_contributors( exclude=exclude_maintainer_ids + exclude_top_contributor_ids ) # Since we need to execute these queries separately anyway, just concatenate # their results instead of making a new query all_contributors = [] - for x in chain( - context["top_contributors_release"], context["top_contributors_overall"] - ): + for x in chain(top_contributors_release, context["top_contributors_overall"]): all_contributors.append( { "name": x.name, } ) - for x in context["maintainers"]: - all_contributors.append( - { - "name": x.get_full_name(), - } - ) all_contributors.sort(key=lambda x: x["name"].lower()) context["all_contributors"] = all_contributors diff --git a/templates/libraries/detail.html b/templates/libraries/detail.html index 2687a8ad..b305e296 100644 --- a/templates/libraries/detail.html +++ b/templates/libraries/detail.html @@ -123,11 +123,17 @@

Maintainers & Contributors

- {% for author in top_contributors_release %} + {% for author in top_contributors_release_new %} {% avatar commitauthor=author is_new=author.is_new %} {% endfor %}
+
+ {% for author in top_contributors_release_old %} + {% avatar commitauthor=author %} + {% endfor %} +
+
{% for author in top_contributors_overall %} {% avatar commitauthor=author %} diff --git a/templates/partials/avatar.html b/templates/partials/avatar.html index f5731785..badaed06 100644 --- a/templates/partials/avatar.html +++ b/templates/partials/avatar.html @@ -6,18 +6,10 @@
- {% if av_is_new %} -
- -
- {% endif %} {% if av_image_url %} {{ av_alt }} @@ -26,9 +18,6 @@ class=" {{ av_icon_size }} align-middle fas fa-user text-white dark:text-white/60 - {% if av_is_new %} - border-2 border-gold - {% endif %} " > {% endif %}