Add friend

This commit is contained in:
cuom1999 2020-06-23 20:46:33 -05:00
parent 5298e6aaa5
commit e951c761f5
12 changed files with 158 additions and 14 deletions

View file

@ -1,5 +1,7 @@
{% extends "user/base-users-table.html" %}
{% set friends = request.profile.get_friends() if request.user.is_authenticated else {} %}
{% block after_rank_head %}
{% if has_rating %}
<th>{{ _('Rating') }}</th>
@ -52,9 +54,7 @@
{% endblock %}
{% block row_extra %}
{% if user.participation.is_disqualified %}
class="disqualified"
{% endif %}
class="{{ 'disqualified' if user.participation.is_disqualified }} {{ 'friend' if user.username in friends }} {{'highlight' if user.username == request.user.username}}"
{% endblock %}
{% block before_point %}

View file

@ -286,6 +286,22 @@
$('#show-organizations-checkbox').click(function () {
$('.organization-column').toggle();
});
{% if request.user.is_authenticated %}
$('#show-friends-checkbox').click(function() {
let checked = $('#show-friends-checkbox').is(':checked');
if (checked) {
$('tbody tr').hide();
$('.friend').show();
$('.friend').last().find('td').css({'border-bottom-width':
'1px', 'border-color': '#ccc'});
}
else {
$('tr').show();
$('.friend').last().find('td').removeAttr('style');
}
})
{% endif %}
highlightFirstSolve();
});
@ -301,7 +317,12 @@
{% endif %}
{% endif %}
<input id="show-organizations-checkbox" type="checkbox" style="vertical-align: bottom">
<label for="show-organizations-checkbox" style="vertical-align: bottom">{{ _('Show organizations') }}</label>
<label for="show-organizations-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show organizations') }}</label>
{% if request.user.is_authenticated %}
<input id="show-friends-checkbox" type="checkbox" style="vertical-align: bottom;">
<label for="show-friends-checkbox" style="vertical-align: bottom;">{{ _('Show friends only') }}</label>
{% endif %}
</div>
{% include "contest/ranking-table.html" %}
{% endblock %}