From 4e0dbbcd79797723198c994b0a012e19e38376f7 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Mon, 27 Dec 2021 17:18:04 +0700 Subject: [PATCH] User table UI --- resources/users.scss | 5 ++++- templates/organization/users.html | 16 ++++++++++++++-- templates/user/base-users-table.html | 2 +- templates/user/base-users.html | 11 +++++++++++ templates/user/list.html | 14 +++++++++++++- templates/user/users-table.html | 28 ++++++++++++++++++---------- 6 files changed, 61 insertions(+), 15 deletions(-) diff --git a/resources/users.scss b/resources/users.scss index cd189fb..e8fbf98 100644 --- a/resources/users.scss +++ b/resources/users.scss @@ -53,7 +53,10 @@ th.header.rank { #users-table { .username { - width: 100%; + } + + .about-column { + width: 30%; } .header { diff --git a/templates/organization/users.html b/templates/organization/users.html index e6d5c44..e6518b6 100644 --- a/templates/organization/users.html +++ b/templates/organization/users.html @@ -5,13 +5,25 @@ margin: -8px 0; padding: 3px 12px; } - #users-table td:nth-child(4), #users-table th:nth-child(4) { + #users-table td:nth-child(3), #users-table th:nth-child(3) { border-right: none; } + .rank-td { + font-family: "Jersey M54"; + font-size: large; + } + .user-points, .user-problem-count, .rating-td { + font-family: cursive; + } + .about-td { + max-height: 45px; + overflow:hidden; + cursor: pointer; + } {% if is_admin %} - diff --git a/templates/user/base-users-table.html b/templates/user/base-users-table.html index bace862..9b75e49 100644 --- a/templates/user/base-users-table.html +++ b/templates/user/base-users-table.html @@ -17,7 +17,7 @@ {% for rank, user in users %} - {{ rank }} + {{ rank }} {% block after_rank scoped %}{% endblock %} {{ link_user(user) }} {% block user_data scoped %}{% endblock %} {% block before_point scoped %}{% endblock %} diff --git a/templates/user/base-users.html b/templates/user/base-users.html index 8048cf3..5cb3ea7 100644 --- a/templates/user/base-users.html +++ b/templates/user/base-users.html @@ -50,11 +50,22 @@ } } }).trigger('hashchange'); + + $('.about-td').on('click', function() { + var max_height = $(this).css('max-height'); + if (max_height !== 'fit-content') { + $(this).css('max-height', 'fit-content'); + } + else { + $(this).css('max-height', '45px'); + } + }) }); {% endblock %} {% block media %} + {% block users_media %}{% endblock %} {% endblock %} diff --git a/templates/user/list.html b/templates/user/list.html index adf9e20..5fbe312 100644 --- a/templates/user/list.html +++ b/templates/user/list.html @@ -2,10 +2,22 @@ {% block users_media %} {% endblock %} diff --git a/templates/user/users-table.html b/templates/user/users-table.html index 2a9e31c..189c3ab 100644 --- a/templates/user/users-table.html +++ b/templates/user/users-table.html @@ -1,6 +1,7 @@ {% extends "user/base-users-table.html" %} {% block after_rank_head %} + {% if sort_links %}{% endif %} @@ -10,19 +11,16 @@ {%- if sort_links %}{{ sort_order.rating }}{% endif %} - {{ _('Full Name') }} {% endblock %} {% block after_rank %} - {% if user.rating %}{{ rating_number(user) }}{% endif %} - - {% if user.user.first_name %} - - {{ user.user.first_name }} - - {% endif %} - + + {% if user.rating %}{{ rating_number(user) }}{% endif %} +{% endblock %} + +{% block user_data %} +{{ "- (" + user.user.first_name + ")" if user.user.first_name else ''}} {% endblock %} {% block after_point_head %} @@ -31,8 +29,18 @@ {{ _('Problems') }} {%- if sort_links %}{{ sort_order.problem_count }}{% endif %} + {{ _('About') }} {% endblock %} {% block after_point %} - {{ user.problem_count }} + {{ user.problem_count }} + +
+ {% if user.about %} + {% cache 86400 'user_about' user.id MATH_ENGINE %} + {{ user.about|markdown('self-description', MATH_ENGINE)|reference|str|safe }} + {% endcache %} + {% endif %} +
+ {% endblock %}