Skip to content

Commit

Permalink
Keep query params between problem feed and list
Browse files Browse the repository at this point in the history
  • Loading branch information
cuom1999 committed Aug 15, 2024
1 parent 091c662 commit ff2c4e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion templates/feed/feed_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
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;
}
Expand Down
11 changes: 9 additions & 2 deletions templates/problem/left-sidebar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{% 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">
{{ make_tab_item('feed', 'far fa-lightbulb', url('problem_feed'), _('Feed')) }}
{{ make_tab_item('list', 'fa fa-list', url('problem_list'), _('List')) }}
{{ make_tab_item('feed', 'far fa-lightbulb', problem_feed_url, _('Feed')) }}
{{ make_tab_item('list', 'fa fa-list', problem_list_url, _('List')) }}
{% if request.user.is_superuser %}
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_problem_changelist'), _('Admin'), force_new_page=True) }}
{% endif %}
Expand Down

0 comments on commit ff2c4e9

Please sign in to comment.