Improve problem search
This commit is contained in:
parent
4d9d1f206a
commit
0b32af57d6
1 changed files with 14 additions and 1 deletions
|
@ -67,11 +67,24 @@
|
||||||
$category.prop('disabled', !$category.val());
|
$category.prop('disabled', !$category.val());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clear_point_interval() {
|
||||||
|
if ($('#search').val() !== "{{ search_query or '' }}") {
|
||||||
|
$('#point-start').remove();
|
||||||
|
$('#point-end').remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function clean_submit() {
|
function clean_submit() {
|
||||||
prep_form();
|
prep_form();
|
||||||
|
clear_point_interval();
|
||||||
$form.submit();
|
$form.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function form_serialize() {
|
||||||
|
clear_point_interval();
|
||||||
|
return $form.serialize();
|
||||||
|
}
|
||||||
|
|
||||||
$category.select2().css({'visibility': 'visible'}).change(clean_submit);
|
$category.select2().css({'visibility': 'visible'}).change(clean_submit);
|
||||||
$('#types').select2({multiple: 1, placeholder: '{{ _('Filter by type...') }}'})
|
$('#types').select2({multiple: 1, placeholder: '{{ _('Filter by type...') }}'})
|
||||||
.css({'visibility': 'visible'});
|
.css({'visibility': 'visible'});
|
||||||
|
@ -95,7 +108,7 @@
|
||||||
|
|
||||||
$('input#full_text, input#hide_solved, input#show_types, input#show_editorial, input#have_editorial').click(function () {
|
$('input#full_text, input#hide_solved, input#show_types, input#show_editorial, input#have_editorial').click(function () {
|
||||||
prep_form();
|
prep_form();
|
||||||
($('<form>').attr('action', window.location.pathname + '?' + $form.serialize())
|
($('<form>').attr('action', window.location.pathname + '?' + form_serialize())
|
||||||
.append($('<input>').attr('type', 'hidden').attr('name', 'csrfmiddlewaretoken')
|
.append($('<input>').attr('type', 'hidden').attr('name', 'csrfmiddlewaretoken')
|
||||||
.attr('value', $.cookie('csrftoken')))
|
.attr('value', $.cookie('csrftoken')))
|
||||||
.attr('method', 'POST').appendTo($('body')).submit());
|
.attr('method', 'POST').appendTo($('body')).submit());
|
||||||
|
|
Loading…
Reference in a new issue