Add keyboard shortcut to expand/collapse board tasks

This commit is contained in:
Frederic Guillot
2015-02-14 22:53:12 -05:00
parent 7c4bdea324
commit 627d8aaa8c
3 changed files with 38 additions and 19 deletions

View File

@@ -16,6 +16,10 @@ Kanboard.Board = (function() {
Kanboard.InitAfterAjax
);
});
Mousetrap.bind("s", function() {
stack_toggle();
});
}
// Collapse/Expand tasks
@@ -24,13 +28,13 @@ Kanboard.Board = (function() {
$(".filter-expand-link").click(function(e) {
e.preventDefault();
stack_expand();
Kanboard.SetStorageItem(stack_key(), "expanded")
Kanboard.SetStorageItem(stack_key(), "expanded");
});
$(".filter-collapse-link").click(function(e) {
e.preventDefault();
stack_collapse();
Kanboard.SetStorageItem(stack_key(), "collapsed")
Kanboard.SetStorageItem(stack_key(), "collapsed");
});
stack_show();
@@ -60,6 +64,20 @@ Kanboard.Board = (function() {
$(".task-board-expanded").show();
}
function stack_toggle()
{
var state = Kanboard.GetStorageItem(stack_key()) || "expanded";
if (state === "expanded") {
stack_collapse();
Kanboard.SetStorageItem(stack_key(), "collapsed");
}
else {
stack_expand();
Kanboard.SetStorageItem(stack_key(), "expanded");
}
}
function stack_show()
{
var state = Kanboard.GetStorageItem(stack_key()) || "expanded";