mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
4db9cbc29c
Fixes the remaining jQuery `.prop()` uses. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
34 lines
954 B
JavaScript
34 lines
954 B
JavaScript
import $ from 'jquery';
|
|
|
|
export function initAdminUserListSearchForm() {
|
|
const searchForm = window.config.pageData.adminUserListSearchForm;
|
|
if (!searchForm) return;
|
|
|
|
const $form = $('#user-list-search-form');
|
|
if (!$form.length) return;
|
|
|
|
$form.find(`button[name=sort][value=${searchForm.SortType}]`).addClass('active');
|
|
|
|
if (searchForm.StatusFilterMap) {
|
|
for (const [k, v] of Object.entries(searchForm.StatusFilterMap)) {
|
|
if (!v) continue;
|
|
$form.find(`input[name="status_filter[${k}]"][value=${v}]`).checked = true;
|
|
}
|
|
}
|
|
|
|
$form.find(`input[type=radio]`).on('click', () => {
|
|
$form.trigger('submit');
|
|
return false;
|
|
});
|
|
|
|
$form.find('.j-reset-status-filter').on('click', () => {
|
|
$form.find(`input[type=radio]`).each((_, e) => {
|
|
const $e = $(e);
|
|
if ($e.attr('name').startsWith('status_filter[')) {
|
|
$e.checked = false;
|
|
}
|
|
});
|
|
$form.trigger('submit');
|
|
return false;
|
|
});
|
|
}
|