diff --git a/src/bundle/Resources/encore/ibexa.js.config.js b/src/bundle/Resources/encore/ibexa.js.config.js index 45a476e77d..fafed96f38 100644 --- a/src/bundle/Resources/encore/ibexa.js.config.js +++ b/src/bundle/Resources/encore/ibexa.js.config.js @@ -130,6 +130,7 @@ module.exports = (Encore) => { .addEntry('ibexa-admin-ui-search-js', [ path.resolve(__dirname, '../public/js/scripts/button.content.edit.js'), path.resolve(__dirname, '../public/js/scripts/admin.search.filters.js'), + path.resolve(__dirname, '../public/js/scripts/admin.search.sorting.js'), path.resolve(__dirname, '../public/js/scripts/admin.search.js'), path.resolve(__dirname, '../public/js/scripts/udw/select.location.js'), path.resolve(__dirname, '../public/js/scripts/button.translation.edit.js'), diff --git a/src/bundle/Resources/public/js/scripts/admin.search.sorting.js b/src/bundle/Resources/public/js/scripts/admin.search.sorting.js new file mode 100644 index 0000000000..cb8c618079 --- /dev/null +++ b/src/bundle/Resources/public/js/scripts/admin.search.sorting.js @@ -0,0 +1,14 @@ +(function (global, doc) { + const searchForm = doc.querySelector('.ibexa-search-form'); + const searchSortOrderSelect = doc.querySelector('.ibexa-search-form__sort-order-select'); + + if (searchSortOrderSelect) { + searchSortOrderSelect.addEventListener( + 'change', + () => { + searchForm.submit(); + }, + false, + ); + } +})(window, window.document); diff --git a/src/bundle/Resources/views/themes/admin/ui/search/results.html.twig b/src/bundle/Resources/views/themes/admin/ui/search/results.html.twig index 12f3e29fca..2968a53d4c 100644 --- a/src/bundle/Resources/views/themes/admin/ui/search/results.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/search/results.html.twig @@ -30,6 +30,8 @@ {% endfor %} + + {{ form_widget(form.sort, { attr: { dropdown_hidden: true }}) }} {% else %}