From 0b32af57d629d514e83b1561584bf3d0a58ca97a Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Sat, 16 Apr 2022 17:11:29 -0500 Subject: [PATCH] Improve problem search --- templates/problem/list.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/templates/problem/list.html b/templates/problem/list.html index e66ca31..b8268f5 100644 --- a/templates/problem/list.html +++ b/templates/problem/list.html @@ -67,11 +67,24 @@ $category.prop('disabled', !$category.val()); } + function clear_point_interval() { + if ($('#search').val() !== "{{ search_query or '' }}") { + $('#point-start').remove(); + $('#point-end').remove(); + } + } + function clean_submit() { prep_form(); + clear_point_interval(); $form.submit(); } + function form_serialize() { + clear_point_interval(); + return $form.serialize(); + } + $category.select2().css({'visibility': 'visible'}).change(clean_submit); $('#types').select2({multiple: 1, placeholder: '{{ _('Filter by type...') }}'}) .css({'visibility': 'visible'}); @@ -95,7 +108,7 @@ $('input#full_text, input#hide_solved, input#show_types, input#show_editorial, input#have_editorial').click(function () { prep_form(); - ($('
').attr('action', window.location.pathname + '?' + $form.serialize()) + ($('').attr('action', window.location.pathname + '?' + form_serialize()) .append($('').attr('type', 'hidden').attr('name', 'csrfmiddlewaretoken') .attr('value', $.cookie('csrftoken'))) .attr('method', 'POST').appendTo($('body')).submit());