mirror of
https://github.com/pretix/pretix.git
synced 2026-10-01 19:14:43 +00:00
Plugin List: Apply search filter if prefilled by browser (#6543)
* Plugin List: Apply searchfilter if prefilled by browser Browsers often prefill the form fields, e.g. with their old content when reloading or going back from the previous page. However these filters were not applied until you changed one of the form fields * Fix linting errors in plugins.js * Apply review suggestions
This commit is contained in:
@@ -49,7 +49,6 @@ const ignores = globalIgnores([
|
||||
'src/pretix/static/pretixcontrol/js/ui/editor.js',
|
||||
'src/pretix/static/pretixcontrol/js/ui/geo.js',
|
||||
'src/pretix/static/pretixcontrol/js/ui/main.js',
|
||||
'src/pretix/static/pretixcontrol/js/ui/plugins.js',
|
||||
'src/pretix/static/pretixcontrol/js/ui/subevent.js',
|
||||
'src/pretix/static/pretixcontrol/js/ui/variations.js',
|
||||
'src/pretix/static/pretixcontrol/js/ui/webauthn.js',
|
||||
|
||||
@@ -67,8 +67,8 @@ $(function () {
|
||||
continue
|
||||
matches.push([rank, plugin])
|
||||
}
|
||||
matches.sort(function (a, b) { return (b[0] - a[0]) || strcmp(a[1].sortName, b[1].sortName) })
|
||||
$results.append(matches.map(function (res) { return $(res[1].html).prepend('<span class="pull-right">' + res[1].categoryLabel + '</span>') }))
|
||||
matches.sort((a, b) => ((b[0] - a[0]) || strcmp(a[1].sortName, b[1].sortName)))
|
||||
$results.append(matches.map((res) => $(res[1].html).prepend('<span class="pull-right">' + res[1].categoryLabel + '</span>')))
|
||||
$results.find('.panel-body, .panel, .featured-plugin, .btn-lg').removeClass('panel-body panel featured-plugin btn-lg')
|
||||
if (matches.length === 0) {
|
||||
$results.append(gettext('No results'))
|
||||
@@ -81,9 +81,10 @@ $(function () {
|
||||
$('#plugin_search_input').val('').trigger('input')
|
||||
})
|
||||
if (location.search) {
|
||||
var search = new URLSearchParams(location.search)
|
||||
if (search.has('q')) {
|
||||
$('#plugin_search_input').val(search.get('q')).trigger('input')
|
||||
const search_params = new URLSearchParams(location.search)
|
||||
if (search_params.has('q')) {
|
||||
$('#plugin_search_input').val(search_params.get('q'))
|
||||
}
|
||||
}
|
||||
search() // if pre-filled by browser (e.g. after reload)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user