Store title & full text in advanced search #32781

This commit is contained in:
Nicolas Demonte 2020-04-08 14:59:18 +02:00
parent 3862c4e497
commit 46a76a1fa0
1 changed files with 20 additions and 0 deletions

View File

@ -490,6 +490,7 @@ function select_metatype(elem)
$('.subtype input').change(store_subtypes);
$('input[name="text-criteria-title"]').on('keyup', function() {
store_history_parameter('title', $(this).val());
if ($('option[value="Title"]:selected').length == 0) {
$('.addIndex option[value="Title"]').prop('selected', true);
$('.addIndex').trigger('change');
@ -499,6 +500,7 @@ function select_metatype(elem)
});
$('input[name="text-criteria-fulltext"]').on('keyup', function() {
store_history_parameter('fulltext', $(this).val());
if ($('option[value="SearchableText"]:selected').length == 0) {
$('.addIndex option[value="SearchableText"]').prop('selected', true);
$('.addIndex').trigger('change');
@ -581,6 +583,24 @@ function select_metatype(elem)
});
metatype.prop('checked', true);
metatype.trigger('change'); // refreshes metatype, then subtypes.
var title = get_history_parameter('title', '');
var fulltext = get_history_parameter('fulltext', '');
if (title) {
$('.addIndex option[value="Title"]').prop('selected', true);
$('.addIndex').trigger('change');
$('option[value="Title"]:selected').parents('select').next().next().val(title);
}
if (fulltext) {
$('.addIndex option[value="SearchableText"]').prop('selected', true);
$('.addIndex').trigger('change');
$('option[value="SearchableText"]:selected').parents('select').next().next().val(fulltext);
}
if (title || fulltext) {
$.querywidget.updateSearch();
$('fieldset.text-fieldset div.criteria-content').show();
$('fieldset.text-fieldset legend').addClass('expanded');
}
}
}
};