Add lazy loading img and fix friend ranking

This commit is contained in:
cuom1999 2024-04-14 00:23:14 -05:00
parent 4a2bc46206
commit 86815fb460
10 changed files with 11 additions and 11 deletions

View file

@ -1018,7 +1018,7 @@ def base_contest_ranking_list(contest, problems, queryset, show_final=False):
def contest_ranking_list(contest, problems, queryset=None, show_final=False): def contest_ranking_list(contest, problems, queryset=None, show_final=False):
if not queryset: if queryset is None:
queryset = contest.users.filter(virtual=0) queryset = contest.users.filter(virtual=0)
if not show_final: if not show_final:

View file

@ -5,7 +5,7 @@
{% with authors=post.get_authors() %} {% with authors=post.get_authors() %}
{%- if authors -%} {%- if authors -%}
<span class="user-img" style="width: 1.5em; height: 1.5em"> <span class="user-img" style="width: 1.5em; height: 1.5em">
<img src="{{gravatar(authors[0])}}"> <img src="{{gravatar(authors[0])}}" loading="lazy">
</span> </span>
<span class="post-authors">{{ link_users(authors) }}</span> <span class="post-authors">{{ link_users(authors) }}</span>
{%- endif -%} {%- endif -%}

View file

@ -1,6 +1,6 @@
<li class="message" id="message-{{ message.id }}" message-id="{{ message.id }}"> <li class="message" id="message-{{ message.id }}" message-id="{{ message.id }}">
<a href="{{ url('user_page', message.author.username) }}"> <a href="{{ url('user_page', message.author.username) }}">
<img src="{{ gravatar(message.author, 135) }}" class="profile-pic user-img"> <img loading="lazy" src="{{ gravatar(message.author, 135) }}" class="profile-pic user-img">
</a> </a>
<div class="body-message"> <div class="body-message">
<div class="user-time"> <div class="user-time">

View file

@ -1,6 +1,6 @@
<li class="status-row" id="lobby_row"> <li class="status-row" id="lobby_row">
<div class="status-container"> <div class="status-container">
<img src="{{ static('icons/icon.svg') }}" style="height:32px"> <img loading="lazy" src="{{ static('icons/icon.svg') }}" style="height:32px">
</div> </div>
<span style="padding-left:0.5em"> <span style="padding-left:0.5em">
<b>{{_('Lobby')}}</b> <b>{{_('Lobby')}}</b>
@ -23,7 +23,7 @@
{% for user in section.user_list %} {% for user in section.user_list %}
<li class="click_space status-row" id="click_space_{{user.user.id}}" value="{{user.url}}"> <li class="click_space status-row" id="click_space_{{user.user.id}}" value="{{user.url}}">
<div class="status-container"> <div class="status-container">
<img src="{{ gravatar(user.user, 135) }}" class="status-pic user-img"> <img loading="lazy" src="{{ gravatar(user.user, 135) }}" class="status-pic user-img">
<svg style="position:absolute;" height="32" width="32"> <svg style="position:absolute;" height="32" width="32">
<circle class="status-circle" fill="{{'green' if user.is_online else 'red'}}"/> <circle class="status-circle" fill="{{'green' if user.is_online else 'red'}}"/>
</svg> </svg>

View file

@ -14,7 +14,7 @@
{% for course in courses %} {% for course in courses %}
<div class="course-item"> <div class="course-item">
<div class="course-image"> <div class="course-image">
<img src="{{course.image_url}}"> <img loading="lazy" src="{{course.image_url}}">
</div> </div>
<div class="course-content"> <div class="course-content">
<a href="{{url('course_detail', course.slug)}}" class="course-name">{{course.name}}</a> <a href="{{url('course_detail', course.slug)}}" class="course-name">{{course.name}}</a>

View file

@ -1,6 +1,6 @@
{% set can_view = submission.is_accessible_by(profile) %} {% set can_view = submission.is_accessible_by(profile) %}
<div class="sub-user-img user-img"> <div class="sub-user-img user-img">
<img src="{{gravatar(submission.user)}}"> <img loading="lazy" src="{{gravatar(submission.user)}}">
</div> </div>
<div class="sub-details"> <div class="sub-details">
<div class="sub-info{% if submission.status == 'G' %} sub-info-grading{% endif %}"> <div class="sub-info{% if submission.status == 'G' %} sub-info-grading{% endif %}">

View file

@ -4,7 +4,7 @@
<div class="header"> <div class="header">
<div class="info"> <div class="info">
<a class="user-container" href="{{ url('user_page', message.user.user.username) }}" class="user"> <a class="user-container" href="{{ url('user_page', message.user.user.username) }}" class="user">
<img src="{{ gravatar(message.user, 135) }}" class="gravatar"> <img loading="lazy" src="{{ gravatar(message.user, 135) }}" class="gravatar">
<span class="username {{ message.user.css_class }}">{{ message.user.user.username }}</span> <span class="username {{ message.user.css_class }}">{{ message.user.user.username }}</span>
</a> </a>
</div> </div>

View file

@ -162,7 +162,7 @@
<section class="message new-message"> <section class="message new-message">
<div class="info"> <div class="info">
<a href="{{ url('user_page', request.user.username) }}" class="user"> <a href="{{ url('user_page', request.user.username) }}" class="user">
<img src="{{ gravatar(request.profile, 135) }}" class="gravatar"> <img loading="lazy" src="{{ gravatar(request.profile, 135) }}" class="gravatar">
<div class="username {{ request.profile.css_class }}">{{ request.user.username }}</div> <div class="username {{ request.profile.css_class }}">{{ request.user.username }}</div>
</a> </a>
</div> </div>

View file

@ -1,7 +1,7 @@
<span class="{{ profile.css_class }} {{'user-with-img' if show_image}}"> <span class="{{ profile.css_class }} {{'user-with-img' if show_image}}">
{% if show_image %} {% if show_image %}
<span class="user-img"> <span class="user-img">
<img src="{{gravatar(profile)}}"> <img loading="lazy" src="{{gravatar(profile)}}">
</span> </span>
{% endif %} {% endif %}
<a href="{{ url('user_page', profile.username) }}"> <a href="{{ url('user_page', profile.username) }}">

View file

@ -5,7 +5,7 @@
{% endblock %} {% endblock %}
{% block after_rank %} {% block after_rank %}
<td><img style="border: 2px solid lightblue; max-width: none;" class="user-img" src="{{ gravatar(user, 45) }}" height="45px" width="45px"></td> <td><img loading="lazy" style="border: 2px solid lightblue; max-width: none;" class="user-img" src="{{ gravatar(user, 45) }}" height="45px" width="45px"></td>
{% endblock %} {% endblock %}
{% block user_footer %} {% block user_footer %}