summaryrefslogtreecommitdiffstats
path: root/web_src/js/features
diff options
context:
space:
mode:
authorTim-Niclas Oelschläger <72873130+zokkis@users.noreply.github.com>2024-03-03 11:18:34 +0100
committerGitHub <noreply@github.com>2024-03-03 10:18:34 +0000
commite3524c63d6d42865ea8288af89b372544d35474b (patch)
treea41eb5e0c2384df29bdb9f00a1b41b30f91bf428 /web_src/js/features
parente71b69257c38178eed9ccd0b62a5ae47d67858d4 (diff)
downloadgitea-e3524c63d6d42865ea8288af89b372544d35474b.tar.gz
gitea-e3524c63d6d42865ea8288af89b372544d35474b.zip
Filter Repositories by type (#29231)
Filter Repositories by type (resolves #1170, #1318) before: ![image](https://github.com/go-gitea/gitea/assets/72873130/74e6be62-9010-4ab4-8f9b-bd8afbebb8fb) after: ![image](https://github.com/go-gitea/gitea/assets/72873130/e4d85ed6-7864-4150-8d72-5194dac1293f)
Diffstat (limited to 'web_src/js/features')
-rw-r--r--web_src/js/features/repo-search.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/web_src/js/features/repo-search.js b/web_src/js/features/repo-search.js
new file mode 100644
index 0000000000..185f6119d9
--- /dev/null
+++ b/web_src/js/features/repo-search.js
@@ -0,0 +1,22 @@
+export function initRepositorySearch() {
+ const repositorySearchForm = document.querySelector('#repo-search-form');
+ if (!repositorySearchForm) return;
+
+ repositorySearchForm.addEventListener('change', (e) => {
+ e.preventDefault();
+
+ const formData = new FormData(repositorySearchForm);
+ const params = new URLSearchParams(formData);
+
+ if (e.target.name === 'clear-filter') {
+ params.delete('archived');
+ params.delete('fork');
+ params.delete('mirror');
+ params.delete('template');
+ params.delete('private');
+ }
+
+ params.delete('clear-filter');
+ window.location.search = params.toString();
+ });
+}