Caching and refactors

This commit is contained in:
cuom1999 2024-04-13 17:02:54 -05:00
parent 67b06d7856
commit 8f1c8d6c96
33 changed files with 485 additions and 381 deletions

View file

@ -27,9 +27,9 @@
<span class="actionbar-text">
{{_("Comment")}}
</span>
{% if comment_count %}
{% if all_comment_count %}
<span style="margin-left: 0.2em">
({{ comment_count }})
({{ all_comment_count }})
</span>
{% endif %}
</span>

View file

@ -19,7 +19,7 @@
<div class="post-full">
<div class="post-title">{{ title }}</div>
<div class="time">
{% with authors=post.authors.all() %}
{% with authors=post.get_authors() %}
{% if authors %}
<span class="post-authors">{{ link_users(authors) }}</span>
{% endif %}

View file

@ -1,8 +1,8 @@
{% for post in posts%}
{% for post in posts %}
<section class="{% if post.sticky %}sticky {% endif %}blog-box">
<div style="margin-bottom: 0.5em">
<span class="post-content-header time">
{% with authors=post.authors.all() %}
{% with authors=post.get_authors() %}
{%- if authors -%}
<span class="user-img" style="width: 1.5em; height: 1.5em">
<img src="{{gravatar(authors[0])}}">
@ -31,7 +31,7 @@
<a href="{{ url('blog_post', post.id, post.slug) }}#comments" class="blog-comment-count-link">
<i class="fa fa-comments blog-comment-icon"></i>
<span class="blog-comment-count">
{{- post.comments.filter(hidden=False).count() or 0 -}}
{{ comment_count(post) }}
</span>
</a>
</span>

View file

@ -79,7 +79,9 @@
{% include 'chat/user_online_status.html' %}
</div>
<div id="chat-box">
<img src="{{static('loading.gif')}}" id="loader" style="display: none;">
<span id="loader" style="font-size: 2em; display: none;">
<i class="fa fa-spinner fa-pulse"></i>
</span>
<ul id="chat-log">
{% include 'chat/message_list.html' %}
</ul>

View file

@ -3,7 +3,7 @@
{{ comment_form.media.js }}
<script type="text/javascript">
$(document).ready(function () {
let loading_gif = "<img src=\"{{static('loading.gif')}}\" style=\"height: 3em; margin-bottom: 3px\" class=\"loading\">";
let loading_gif = "<i class=\"fa fa-spinner fa-pulse loading\" style=\"font-size: 1.5em\"></i>";
window.reply_comment = function (parent) {
var $comment_reply = $('#comment-' + parent + '-reply');
var reply_id = 'reply-' + parent;

View file

@ -1,6 +1,6 @@
<style>
#users-table td {
height: 2.5em;
min-height: 2.5em;
}
#users-table a {

View file

@ -13,18 +13,23 @@
{% endblock %}
{% block user_footer %}
{% if user.user.first_name %}
{% set profile = user.user %}
{% if profile.first_name %}
<div style="font-weight: 600; display: none" class="fullname gray">
{{ user.user.first_name }}
{{ profile.first_name }}
</div>
{% endif %}
{% if user.user.last_name %}
{% if profile.last_name %}
<div class="school gray" style="display: none"><div style="font-weight: 600">
{{- user.user.last_name -}}
{{ profile.last_name }}
</div></div>
{% endif %}
{% endblock %}
{% block user_link %}
{{ link_user(user.user, show_image=True) }}
{% endblock %}
{% block user_data %}
{% if user.participation.virtual %}
<sub class="gray">[{{user.participation.virtual}}]</sub>

View file

@ -150,7 +150,7 @@
<label for="show-total-score-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Total score only') }}</label>
<input id="show-virtual-checkbox" type="checkbox" style="vertical-align: bottom;">
<label id="show-virtual-label" for="show-virtual-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show virtual participation') }}</label>
<img src="{{static('loading.gif')}}" style="height: 1em; display:none;" id="loading-gif"></img>
<i class="fa fa-spinner fa-pulse" style="display: none" id="loading-gif"></i>
<a href="#" onclick="download_ranking_as_csv()">
<i class="fa fa-download" aria-hidden="true"></i>
{{ _('Download as CSV') }}

View file

@ -27,5 +27,5 @@
<li><a href="{{url('admin:judge_volunteerproblemvote_changelist')}}">{{_('View your votes')}}</a></li>
</ul>
{% endif %}
{% include "problem/feed/problems.html" %}
{% include "problem/feed/items.html" %}
{% endblock %}

View file

@ -12,7 +12,7 @@
<i class="unsolved-problem-color fa fa-minus-circle"></i>
{% endif %}
</h3>
{% with authors=problem.authors.all() %}
{% with authors=problem.get_authors() %}
{% if authors %}
<div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i>

View file

@ -260,21 +260,19 @@
<hr style="padding-top: 0.7em">
{% cache 86400 'problem_authors' problem.id LANGUAGE_CODE %}
{% with authors=problem.authors.all() %}
{% if authors %}
<div class="problem-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i><span
class="pi-name">{% trans trimmed count=authors|length %}
Author:
{% pluralize count %}
Authors:
{% endtrans %}</span>
<div class="pi-value authors-value">{{ link_users(authors) }}</div>
</div>
{% endif %}
{% endwith %}
{% endcache %}
{% with authors=problem.get_authors() %}
{% if authors %}
<div class="problem-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i><span
class="pi-name">{% trans trimmed count=authors|length %}
Author:
{% pluralize count %}
Authors:
{% endtrans %}</span>
<div class="pi-value authors-value">{{ link_users(authors) }}</div>
</div>
{% endif %}
{% endwith %}
{% if not contest_problem or not contest_problem.contest.hide_problem_tags %}
<div id="problem-types">

View file

@ -19,7 +19,15 @@
<tr id="user-{{ user.username }}" {% block row_extra scoped %}{% endblock %}>
<td class="rank-td">{{ rank }}</td>
{% block after_rank scoped %}{% endblock %}
<td class="user-name"><div style="display: inline-block;">{{ link_user(user) }}{% block user_footer scoped %}{% endblock %}</div> {% block user_data scoped %}{% endblock %}</td>
<td class="user-name">
<div style="display: inline-block;">
{% block user_link scoped %}
{{ link_user(user) }}
{% endblock %}
{% block user_footer scoped %}{% endblock %}
</div>
{% block user_data scoped %}{% endblock %}
</td>
{% block before_point scoped %}{% endblock %}
{% block point scoped %}
<td title="{{ user.performance_points|floatformat(2) }}" class="user-points">

View file

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