mirror of
https://github.com/boostorg/website-v2.git
synced 2026-01-19 04:42:17 +00:00
Update avatars to add hq_image, use with fiscal committee list (#1869(
This commit is contained in:
committed by
Kari Skinner
parent
adebb47258
commit
bf7041184d
@@ -187,7 +187,7 @@ ul.slack-channels li div a:hover,
|
||||
<div class="committee_members flex flex-wrap mt-2 text-sm text-center absolute" style="">
|
||||
{% for user in committee_members|dictsort:"display_name" %}
|
||||
<figure class="w-32 m-2">
|
||||
{% avatar user=user is_link=False image_size="w-32 h-32" icon_size="text-8xl" %}
|
||||
{% avatar user=user is_link=False image_size="w-32 h-32" icon_size="text-8xl" use_user_hq_image=True %}
|
||||
<figcaption class="p-1">{{user.display_name}}</figcaption>
|
||||
</figure>
|
||||
{% endfor %}
|
||||
|
||||
@@ -292,6 +292,12 @@ class User(BaseUser):
|
||||
with suppress(AttributeError, MissingSource):
|
||||
return getattr(self.image_thumbnail, "url", None)
|
||||
|
||||
def get_hq_image_url(self):
|
||||
# convenience method for templates
|
||||
if self.hq_image and self.hq_image_render:
|
||||
with suppress(AttributeError, MissingSource):
|
||||
return getattr(self.hq_image_render, "url", None)
|
||||
|
||||
@property
|
||||
def github_profile_url(self):
|
||||
if not self.github_username:
|
||||
|
||||
@@ -44,6 +44,7 @@ def avatar(
|
||||
icon_size=None,
|
||||
contributor_label=None,
|
||||
avatar_type=None,
|
||||
use_user_hq_image=False,
|
||||
):
|
||||
def get_commit_author_attribute(commitauthor, attribute):
|
||||
if isinstance(commitauthor, dict):
|
||||
@@ -64,22 +65,27 @@ def avatar(
|
||||
}
|
||||
|
||||
if user and commitauthor:
|
||||
image_url = user.get_thumbnail_url() or get_commit_author_attribute(
|
||||
std_image = user.get_thumbnail_url() or get_commit_author_attribute(
|
||||
commitauthor, "avatar_url"
|
||||
)
|
||||
hq_image = user.get_hq_image_url()
|
||||
use_hq_image = use_user_hq_image and hq_image
|
||||
href = user.github_profile_url or get_commit_author_attribute(
|
||||
commitauthor, "github_profile_url"
|
||||
)
|
||||
return base_avatar(
|
||||
commitauthor.display_name,
|
||||
image_url,
|
||||
hq_image if use_hq_image else std_image,
|
||||
href,
|
||||
**kwargs,
|
||||
)
|
||||
elif user:
|
||||
std_image = user.get_thumbnail_url()
|
||||
hq_image = user.get_hq_image_url()
|
||||
use_hq_image = use_user_hq_image and hq_image
|
||||
return base_avatar(
|
||||
user.display_name,
|
||||
user.get_thumbnail_url(),
|
||||
hq_image if use_hq_image else std_image,
|
||||
user.github_profile_url,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user