From ff2c4e91d2349f47c4fe282fca20eff47eb742cf Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Thu, 15 Aug 2024 15:08:36 +0700 Subject: [PATCH] Keep query params between problem feed and list --- templates/feed/feed_js.html | 4 +++- templates/problem/left-sidebar.html | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/templates/feed/feed_js.html b/templates/feed/feed_js.html index 904f6e4..8abc8a7 100644 --- a/templates/feed/feed_js.html +++ b/templates/feed/feed_js.html @@ -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; } diff --git a/templates/problem/left-sidebar.html b/templates/problem/left-sidebar.html index 45074ac..2b94f68 100644 --- a/templates/problem/left-sidebar.html +++ b/templates/problem/left-sidebar.html @@ -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 %}