Memorize contest filter and fix some css
This commit is contained in:
parent
64a3d1bbb2
commit
a4c2fad04f
3 changed files with 18 additions and 2 deletions
|
@ -153,11 +153,25 @@ class ContestList(
|
||||||
def _now(self):
|
def _now(self):
|
||||||
return timezone.now()
|
return timezone.now()
|
||||||
|
|
||||||
|
def GET_with_session(self, request, key):
|
||||||
|
if not request.GET.get(key):
|
||||||
|
return request.session.get(key, False)
|
||||||
|
return request.GET.get(key, None) == "1"
|
||||||
|
|
||||||
|
def update_session(self, request):
|
||||||
|
to_update = ("show_orgs",)
|
||||||
|
for key in to_update:
|
||||||
|
if key in request.GET:
|
||||||
|
val = request.GET.get(key) == "1"
|
||||||
|
request.session[key] = val
|
||||||
|
else:
|
||||||
|
request.session[key] = False
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
self.contest_query = None
|
self.contest_query = None
|
||||||
self.org_query = []
|
self.org_query = []
|
||||||
self.show_orgs = 0
|
self.show_orgs = 0
|
||||||
if request.GET.get("show_orgs"):
|
if self.GET_with_session(request, "show_orgs"):
|
||||||
self.show_orgs = 1
|
self.show_orgs = 1
|
||||||
|
|
||||||
if self.request.GET.get("orgs") and self.request.profile:
|
if self.request.GET.get("orgs") and self.request.profile:
|
||||||
|
@ -177,6 +191,7 @@ class ContestList(
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
self.update_session(request)
|
||||||
return super(ContestList, self).get(request, *args, **kwargs)
|
return super(ContestList, self).get(request, *args, **kwargs)
|
||||||
|
|
||||||
def _get_queryset(self):
|
def _get_queryset(self):
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
line-height: 1.6em;
|
line-height: 1.6em;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-family: "Segoe UI", "Noto Sans", Arial, "Lucida Grande", sans-serif;
|
font-family: "Segoe UI", "Noto Sans", Arial, "Lucida Grande", sans-serif;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, .admonition-title, summary {
|
h1, h2, h3, h4, h5, .admonition-title, summary {
|
||||||
font-family: "Noto Sans", "Segoe UI", Arial, "Lucida Grande", sans-serif;
|
font-family: "Noto Sans", "Segoe UI", Arial, "Lucida Grande", sans-serif;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<div class="organization-container toggled">
|
<div class="organization-container toggled">
|
||||||
{% for org in queryset %}
|
{% for org in queryset %}
|
||||||
<a href="{{ org.get_absolute_url() }}" class="organization-row" title="{{org.about}}">
|
<a href="{{ org.get_absolute_url() }}" class="organization-row" title="{{org.about}}">
|
||||||
<img class="org-logo" loading="lazy" src="{{ org.logo_override_image or static('icons/logo.svg') }}">
|
<img class="org-logo" loading="lazy" src="{{ org.logo_override_image or static('icons/icon.svg') }}" onerror="{{static('icons/logo.svg')}}">
|
||||||
<span style="margin-right: auto">{{ org.name }}</span>
|
<span style="margin-right: auto">{{ org.name }}</span>
|
||||||
<span style="font-weight: normal"><i>{{ org.member_count }} {{_('members')}}</i></span>
|
<span style="font-weight: normal"><i>{{ org.member_count }} {{_('members')}}</i></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue