Keep query params between problem feed and list

This commit is contained in:
cuom1999 2024-08-15 15:08:36 +07:00
parent 091c662b3b
commit ff2c4e91d2
2 changed files with 12 additions and 3 deletions

View file

@ -9,7 +9,9 @@
var vars = query.split("&"); var vars = query.split("&");
for (var i = 0; i < vars.length; i++) { for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("="); var pair = vars[i].split("=");
queryParams[pair[0]] = decodeURIComponent(pair[1]); var key = decodeURIComponent(pair[0]);
var value = decodeURIComponent(pair[1].replace(/\+/g, ' '));
queryParams[key] = value;
} }
return queryParams; return queryParams;
} }

View file

@ -1,7 +1,14 @@
{% if not show_contest_mode %} {% if not show_contest_mode %}
{% set query_string = request.GET.urlencode() %}
{% set problem_feed_url = url('problem_feed') %}
{% set problem_list_url = url('problem_list') %}
{% if search_query %}
{% set problem_feed_url = problem_feed_url + '?' + query_string %}
{% set problem_list_url = problem_list_url + '?' + query_string %}
{% endif %}
<div class="left-sidebar"> <div class="left-sidebar">
{{ make_tab_item('feed', 'far fa-lightbulb', url('problem_feed'), _('Feed')) }} {{ make_tab_item('feed', 'far fa-lightbulb', problem_feed_url, _('Feed')) }}
{{ make_tab_item('list', 'fa fa-list', url('problem_list'), _('List')) }} {{ make_tab_item('list', 'fa fa-list', problem_list_url, _('List')) }}
{% if request.user.is_superuser %} {% if request.user.is_superuser %}
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_problem_changelist'), _('Admin'), force_new_page=True) }} {{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_problem_changelist'), _('Admin'), force_new_page=True) }}
{% endif %} {% endif %}