Skip to content

Commit

Permalink
New contributor visual changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjp93 committed Sep 30, 2024
1 parent dca2de1 commit 13d296e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
20 changes: 8 additions & 12 deletions libraries/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion templates/libraries/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,17 @@ <h2 class="text-2xl">Maintainers &amp; Contributors</h2>
</div>

<div class="flex flex-wrap justify-center gap-2">
{% for author in top_contributors_release %}
{% for author in top_contributors_release_new %}
{% avatar commitauthor=author is_new=author.is_new %}
{% endfor %}
</div>

<div class="flex flex-wrap justify-center gap-2">
{% for author in top_contributors_release_old %}
{% avatar commitauthor=author %}
{% endfor %}
</div>

<div class="flex flex-wrap justify-center gap-2">
{% for author in top_contributors_overall %}
{% avatar commitauthor=author %}
Expand Down
11 changes: 0 additions & 11 deletions templates/partials/avatar.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@
<div
class="{{ av_size }} bg-gray-300 dark:bg-slate flex items-center justify-center relative rounded-lg"
title="{{ av_title }}{% if av_is_new %} - NEW!{% endif %}">
{% if av_is_new %}
<div class="absolute top-[-12px] right-[-8px]">
<i class="fas fa-solid fa-star text-sm text-gold"></i>
</div>
{% endif %}
{% if av_image_url %}
<img src="{{ av_image_url }}"
alt="{{ av_alt }}"
class="
{% if av_is_new %}
border-2 border-gold
{% endif %}
rounded-lg h-full w-full object-cover mx-auto
"
/>
Expand All @@ -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 %}
"
></i>
{% endif %}
Expand Down

0 comments on commit 13d296e

Please sign in to comment.