Store subtypes in advanced search #32781
This commit is contained in:
parent
7479ee5c29
commit
ba23189791
|
@ -408,6 +408,15 @@ function update_portaltypes()
|
|||
$.querywidget.updateSearch();
|
||||
}
|
||||
|
||||
function store_subtypes() {
|
||||
var metatype = $('.metatypes input:checked').val();
|
||||
var chosen_types = $.map(
|
||||
$('.subtype.'+metatype+' input[data-portaltype]:checked'),
|
||||
function(val, i) { return $(val).data('portaltype'); }
|
||||
);
|
||||
store_history_parameter('subtypes', chosen_types);
|
||||
}
|
||||
|
||||
function select_metatype(elem)
|
||||
{
|
||||
$('div.subtype').hide();
|
||||
|
@ -472,6 +481,7 @@ function select_metatype(elem)
|
|||
return false;
|
||||
});
|
||||
$('.subtype input').change(update_portaltypes);
|
||||
$('.subtype input').change(store_subtypes);
|
||||
|
||||
$('input[name="text-criteria-title"]').on('keyup', function() {
|
||||
if ($('option[value="Title"]:selected').length == 0) {
|
||||
|
@ -559,7 +569,12 @@ function select_metatype(elem)
|
|||
if (history_state !== null) {
|
||||
if (history_state.metatype !== undefined) {
|
||||
var metatype = $('.metatypes [value="' + history_state.metatype + '"]');
|
||||
metatype.prop('checked', true).trigger('change');
|
||||
var subtypes = history_state.subtypes || [];
|
||||
$.each(subtypes, function(index, value) {
|
||||
$('input[data-portaltype="' + value + '"]').prop('checked', true);
|
||||
});
|
||||
metatype.prop('checked', true);
|
||||
metatype.trigger('change'); // refreshes metatype, then subtypes.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Reference in New Issue