summaryrefslogtreecommitdiffstats
path: root/public/js
diff options
context:
space:
mode:
authorjaqra <48099350+jaqra@users.noreply.github.com>2019-10-23 19:29:14 +0300
committerzeripath <art27@cantab.net>2019-10-23 17:29:14 +0100
commitdbd9d8dd54fd3b0ff7b02ae7b7da8369654e3725 (patch)
tree972d334a1a6d98b8186c99511ad03234d32e6b8c /public/js
parent637e3219ab477a554567ec2ecbf0050b61942a50 (diff)
downloadgitea-dbd9d8dd54fd3b0ff7b02ae7b7da8369654e3725.tar.gz
gitea-dbd9d8dd54fd3b0ff7b02ae7b7da8369654e3725.zip
Add 'Alt + click' feature to exclude labels (#8199)
Add 'Alt + click' and 'Alt +enter' feature to exclude particular labels on searching for issues.
Diffstat (limited to 'public/js')
-rw-r--r--public/js/index.js35
1 files changed, 33 insertions, 2 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 90819677a5..cf19bf71a0 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -3278,8 +3278,39 @@ function initIssueList() {
},
fullTextSearch: true
- })
- ;
+ });
+
+ $(".menu a.label-filter-item").each(function() {
+ $(this).click(function(e) {
+ if (e.altKey) {
+ const href = $(this).attr("href");
+ const id = $(this).data("label-id");
+
+ const regStr = "labels=(-?[0-9]+%2c)*(" + id + ")(%2c-?[0-9]+)*&";
+ const newStr = "labels=$1-$2$3&";
+
+ window.location = href.replace(new RegExp(regStr), newStr);
+ }
+ });
+ });
+
+ $(".menu .ui.dropdown.label-filter").keydown(function(e) {
+ if (e.altKey && e.keyCode == 13) {
+ const selectedItems = $(".menu .ui.dropdown.label-filter .menu .item.selected");
+
+ if (selectedItems.length > 0) {
+ const item = $(selectedItems[0]);
+
+ const href = item.attr("href");
+ const id = item.data("label-id");
+
+ const regStr = "labels=(-?[0-9]+%2c)*(" + id + ")(%2c-?[0-9]+)*&";
+ const newStr = "labels=$1-$2$3&";
+
+ window.location = href.replace(new RegExp(regStr), newStr);
+ }
+ }
+ });
}
function cancelCodeComment(btn) {
const form = $(btn).closest("form");