mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
56362043d3
* frontend refactor
* Apply suggestions from code review
Co-authored-by: delvh <dev.lh@web.de>
* Update templates/base/head.tmpl
Co-authored-by: delvh <dev.lh@web.de>
* Update docs/content/doc/developers/guidelines-frontend.md
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* fix typo
* fix typo
* refactor PageData to pageData
* Apply suggestions from code review
Co-authored-by: delvh <dev.lh@web.de>
* Simply for the visual difference.
Co-authored-by: delvh <dev.lh@web.de>
* Revert "Apply suggestions from code review"
This reverts commit 4d78ad9b0e
.
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
33 lines
913 B
JavaScript
33 lines
913 B
JavaScript
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}]`).prop('checked', true);
|
|
}
|
|
}
|
|
|
|
$form.find(`input[type=radio]`).click(() => {
|
|
$form.submit();
|
|
return false;
|
|
});
|
|
|
|
$form.find('.j-reset-status-filter').click(() => {
|
|
$form.find(`input[type=radio]`).each((_, e) => {
|
|
const $e = $(e);
|
|
if ($e.attr('name').startsWith('status_filter[')) {
|
|
$e.prop('checked', false);
|
|
}
|
|
});
|
|
$form.submit();
|
|
return false;
|
|
});
|
|
}
|