diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-02-14 22:53:12 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-02-14 22:53:12 -0500 |
commit | 627d8aaa8c7669fe2c486049d3c1fba4a7f31e74 (patch) | |
tree | 011501eab9346375162388faf91c2205113062c2 /assets/js/src | |
parent | 7c4bdea324d8074ffcc3fa353fcfd85ee8066634 (diff) |
Add keyboard shortcut to expand/collapse board tasks
Diffstat (limited to 'assets/js/src')
-rw-r--r-- | assets/js/src/board.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/assets/js/src/board.js b/assets/js/src/board.js index 45b43794..ecf94b9c 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -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"; |