From 32a1ea8919c2c8d9df130487dca3c769c27dd181 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Fri, 17 Nov 2023 01:11:54 -0600 Subject: [PATCH 1/2] Fix contest filter --- judge/views/contests.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/judge/views/contests.py b/judge/views/contests.py index d76bf66..80e5fb5 100644 --- a/judge/views/contests.py +++ b/judge/views/contests.py @@ -146,7 +146,7 @@ class ContestList( default_desc = frozenset(("name", "user_count")) def get_default_sort_order(self, request): - if "contest" in request.GET and settings.ENABLE_FTS: + if request.GET.get("contest") and settings.ENABLE_FTS: return "-relevance" return "-start_time" @@ -161,7 +161,7 @@ class ContestList( if request.GET.get("show_orgs"): self.show_orgs = 1 - if "orgs" in self.request.GET and self.request.profile: + if self.request.GET.get("orgs") and self.request.profile: try: self.org_query = list(map(int, request.GET.getlist("orgs"))) if not self.request.user.is_superuser: @@ -169,8 +169,10 @@ class ContestList( i for i in self.org_query if i - in self.request.profile.organizations.values_list( - "id", flat=True + in set( + self.request.profile.organizations.values_list( + "id", flat=True + ) ) ] except ValueError: @@ -185,7 +187,7 @@ class ContestList( .prefetch_related("tags", "organizations", "authors", "curators", "testers") ) - if "contest" in self.request.GET: + if self.request.GET.get("contest"): self.contest_query = query = " ".join( self.request.GET.getlist("contest") ).strip() @@ -253,10 +255,7 @@ class ContestList( context["org_query"] = self.org_query context["show_orgs"] = int(self.show_orgs) if self.request.profile: - if self.request.user.is_superuser: - context["organizations"] = Organization.objects.all() - else: - context["organizations"] = self.request.profile.organizations.all() + context["organizations"] = self.request.profile.organizations.all() context["page_type"] = "list" context.update(self.get_sort_context()) context.update(self.get_sort_paginate_context()) From 729a28bce581670a2d36122782c0eddf878453ea Mon Sep 17 00:00:00 2001 From: Van Duc Le <121172468+yucyle@users.noreply.github.com> Date: Thu, 23 Nov 2023 21:23:14 -0600 Subject: [PATCH 2/2] New Problem UI (Problem Information & Submit Button) (#95) --- locale/vi/LC_MESSAGES/django.po | 2 +- resources/problem.scss | 16 +++- resources/style.scss | 2 +- resources/widgets.scss | 138 +++++++++++++++++++++++++++++++- templates/problem/problem.html | 34 +++++--- 5 files changed, 177 insertions(+), 15 deletions(-) diff --git a/locale/vi/LC_MESSAGES/django.po b/locale/vi/LC_MESSAGES/django.po index 338f920..a999e03 100644 --- a/locale/vi/LC_MESSAGES/django.po +++ b/locale/vi/LC_MESSAGES/django.po @@ -4753,7 +4753,7 @@ msgstr "Phiếu tình nguyện" #: templates/problem/feed/problems.html:53 msgid "Submit" -msgstr "Gửi" +msgstr "Nộp bài" #: templates/problem/feed/problems.html:60 msgid "Value" diff --git a/resources/problem.scss b/resources/problem.scss index ff2b8d1..b3a21a1 100644 --- a/resources/problem.scss +++ b/resources/problem.scss @@ -422,13 +422,25 @@ ul.problem-list { border-radius: 25px; font-size: 14px; height: 25px; - width: 100%; + width: 98%; display: table; padding: 5px; - margin-top: 12px; + margin-top: 14px; + border: solid; + border-color: black; + border-width: 0.1px; } .info-block { display:table-cell; vertical-align:middle; + margin-right: auto; +} + +@media screen and (min-width: 1100px) { + .d-flex-problem { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + } } \ No newline at end of file diff --git a/resources/style.scss b/resources/style.scss index eac2a94..5fe41e2 100644 --- a/resources/style.scss +++ b/resources/style.scss @@ -16,4 +16,4 @@ @import "organization"; @import "ticket"; @import "pagedown_widget"; -@import "dmmd-preview"; +@import "dmmd-preview"; \ No newline at end of file diff --git a/resources/widgets.scss b/resources/widgets.scss index 42e8c8e..96d2ba9 100644 --- a/resources/widgets.scss +++ b/resources/widgets.scss @@ -28,6 +28,9 @@ // Bootstrap-y buttons .button, button, input[type=submit] { + -webkit-transition: .3s all ease; + -o-transition: .3s all ease; + transition: .3s all ease; align-items: center; background-clip: padding-box; background-color: $theme_color; @@ -78,10 +81,10 @@ } &.btn-green { - background: green; + background: #28a745; &:hover { - background: #2c974b; + background: green; } } @@ -741,4 +744,135 @@ ul.errorlist { .github-icon i { color: black; } +} + +@media (prefers-reduced-motion: reduce) { + .btn { + -webkit-transition: none; + -o-transition: none; + transition: none; + } +} + +.btn:hover { + color: #212529; + text-decoration: none; +} + +.btn-block { + display: block; + width: 100%; +} + +.btn-block + .btn-block { + margin-top: 0.5rem; +} + +.d-flex { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; +} + +.justify-content-center { + -webkit-box-pack: center !important; + -ms-flex-pack: center !important; + justify-content: center !important; +} + +.align-items-center { + -webkit-box-align: center !important; + -ms-flex-align: center !important; + align-items: center !important; +} + +.align-content-center { + -ms-flex-line-pack: center !important; + align-content: center !important; +} + +.align-self-center { + -ms-flex-item-align: center !important; + -ms-grid-row-align: center !important; + align-self: center !important; +} + +body { + font-size: 15px; + line-height: 1.8; + font-weight: normal; +} + +a { + -webkit-transition: .3s all ease; + -o-transition: .3s all ease; + transition: .3s all ease; +} + +button:hover, button:focus { + text-decoration: none !important; + outline: none !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; +} + +.btn { + padding: 8px 12px; + cursor: pointer; + border-width: 1px; + border-radius: 5px; + font-size: 14px; + font-weight: 500; + -webkit-box-shadow: 0px 10px 20px -6px rgba(0, 0, 0, 0.12); + -moz-box-shadow: 0px 10px 20px -6px rgba(0, 0, 0, 0.12); + box-shadow: 0px 10px 20px -6px rgba(0, 0, 0, 0.12); + overflow: hidden; + position: relative; + -moz-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + transition: all 0.3s ease; + span { + margin-left: -20px; + -moz-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + transition: all 0.3s ease; + } + .icon { + position: absolute; + top: 0; + right: 0; + width: 45px; + bottom: 0; + background: #fff; + i { + font-size: 20px; + } + } + .icon.icon-round { + border-radius: 50%; + } + &.btn-round { + border-radius: 40px; + } + &:hover, &:active, &:focus { + outline: none; + span { + margin-left: -10px; + } + } + &.btn-primary { + color: #fff; + .icon i { + color: #28a745; + } + } + &.btn-disabled { + color: #fff; + background: gray; + border-color: gray; + } } \ No newline at end of file diff --git a/templates/problem/problem.html b/templates/problem/problem.html index a2ee4fd..acf56f3 100644 --- a/templates/problem/problem.html +++ b/templates/problem/problem.html @@ -49,6 +49,11 @@ {% endblock %} {% block content_js_media %} + {% include "comments/media-js.html" %} {% include "actionbar/media-js.html" %} {% if request.in_contest_mode %} @@ -138,9 +143,12 @@ {% block info_float %} {% if request.user.is_authenticated and request.in_contest_mode and submission_limit %} {% if submissions_left > 0 %} - - {{ _('Submit solution') }} - +
{% trans trimmed counter=submissions_left %} {{ counter }} submission left @@ -149,13 +157,21 @@ {% endtrans %}
{% else %} - {{ _('Submit solution') }} +
{{ _('0 submissions left') }}
{% endif %} {% else %} - - {{ _('Submit solution') }} - + {% endif %}
@@ -295,7 +311,7 @@ {% endif %} -
+
{{ _('Points:') }} @@ -324,7 +340,7 @@ - + {{ _('Output:') }} {{ fileio_output or _('stdout') }}