mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-10 10:44:06 +09:00
Add 'Alt + click' feature to exclude labels (#8199)
Add 'Alt + click' and 'Alt +enter' feature to exclude particular labels on searching for issues.
This commit is contained in:
@ -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");
|
||||
|
Reference in New Issue
Block a user