forked from forgejo/forgejo
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:
parent
637e3219ab
commit
dbd9d8dd54
7 changed files with 67 additions and 7 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue