Add full name to user tables

This commit is contained in:
cuom1999 2020-12-29 20:29:50 -06:00
parent 4502dbf6b9
commit 0adbc74d95
7 changed files with 489 additions and 323 deletions

View file

@ -19,7 +19,7 @@ from reversion import revisions
from judge.forms import EditOrganizationForm
from judge.models import BlogPost, Comment, Organization, OrganizationRequest, Problem, Profile, Contest
from judge.utils.ranker import ranker
from judge.utils.views import TitleMixin, generic_message
from judge.utils.views import TitleMixin, generic_message, QueryStringSortMixin, DiggPaginatorMixin
__all__ = ['OrganizationList', 'OrganizationHome', 'OrganizationUsers', 'OrganizationMembershipChange',
'JoinOrganization', 'LeaveOrganization', 'EditOrganization', 'RequestJoinOrganization',
@ -117,18 +117,25 @@ class OrganizationHome(OrganizationDetailView):
return context
class OrganizationUsers(OrganizationDetailView):
class OrganizationUsers(QueryStringSortMixin, OrganizationDetailView):
template_name = 'organization/users.html'
all_sorts = frozenset(('points', 'problem_count', 'rating', 'performance_points'))
default_desc = all_sorts
default_sort = '-performance_points'
def get_context_data(self, **kwargs):
context = super(OrganizationUsers, self).get_context_data(**kwargs)
context['title'] = _('%s Members') % self.object.name
context['users'] = \
ranker(self.object.members.filter(is_unlisted=False).order_by('-performance_points', '-problem_count')
.select_related('user').defer('about', 'user_script', 'notes'))
context['partial'] = True
context['is_admin'] = self.can_edit_organization()
context['kick_url'] = reverse('organization_user_kick', args=[self.object.id, self.object.slug])
context['users'] = ranker(
self.get_object().members.filter(is_unlisted=False).order_by(self.order, 'id').select_related('user') \
.only('display_rank', 'user__username', 'points', 'rating', 'performance_points', 'problem_count')
)
context['first_page_href'] = '.'
context.update(self.get_sort_context())
return context

File diff suppressed because it is too large Load diff

View file

@ -83,3 +83,22 @@
border-bottom-left-radius: 0 !important;
}
}
#users-table td:nth-child(2), #users-table th:nth-child(2) {
border-right: none;
text-align: left;
}
#users-table .fullname-column {
text-align: right !important;
border-right: none !important;
}
#users-table .fullname-column span {
color: gray !important;
font-weight: 600;
}
#users-table th a {
color: white;
}

View file

@ -7,7 +7,7 @@
<th>{{ _('Rating') }}</th>
{% endif %}
<th class="organization-column">{{ _('Organization') }}</th>
<th class="fullname-column" style="display: none;">Tên thật</th>
<th class="fullname-column" style="display: none;">{{ _('Full Name') }}</th>
{% endblock %}
{% block after_rank %}

View file

@ -1,13 +1,12 @@
{% extends "user/base-users.html" %}
{% block users_media %}
<style>
#users-table td:nth-child(2), #users-table th:nth-child(2) {
border-right: none;
text-align: left;
}
.kick-form .button {
margin: -8px 0;
padding: 3px 12px;
}
#users-table td:nth-child(4), #users-table th:nth-child(4) {
border-right: none;
}
</style>

View file

@ -6,10 +6,6 @@
border-right: none;
text-align: left;
}
#users-table th a {
color: white;
}
</style>
{% endblock %}

View file

@ -10,11 +10,19 @@
</svg>
</span>
{%- if sort_links %}{{ sort_order.rating }}</a>{% endif %}
<th class="fullname-column">{{ _('Full Name') }}</th>
</th>
{% endblock %}
{% block after_rank %}
<td>{% if user.rating %}{{ rating_number(user) }}{% endif %}</td>
<td class="fullname-column">
{% if user.user.first_name %}
<span class="fullname">
{{ user.user.first_name }}
</span>
{% endif %}
</td>
{% endblock %}
{% block after_point_head %}