diff options
Diffstat (limited to 'assets/js/src/board.js')
-rw-r--r-- | assets/js/src/board.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/assets/js/src/board.js b/assets/js/src/board.js index 75c44f2e..26d92c05 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -23,6 +23,10 @@ Kanboard.Board = (function() { Mousetrap.bind("s", function() { stack_toggle(); }); + + Mousetrap.bind("c", function() { + compactview_toggle(); + }); } // Collapse/Expand tasks @@ -351,6 +355,35 @@ Kanboard.Board = (function() { filter_apply(); } + // Toggle compact view. It will try to stuff all columns in the window + jQuery(document).on('click', ".compactview-toggle", function(e) { + e.preventDefault(); + compactview_toggle(); + }); + + function compactview_toggle() { + var compactview = Kanboard.GetStorageItem("compactview"); + if (compactview == '1') { + Kanboard.SetStorageItem("compactview",'0'); + } else { + Kanboard.SetStorageItem("compactview",'1'); + } + compactview_reload (); + } + + function compactview_reload() + { + var compactview = Kanboard.GetStorageItem("compactview"); + $("#board-container,#board th,#board td").removeClass (); + if (compactview == '1') { + $('#board-container').addClass ('board-container-compact'); + $("#board th,#board td").addClass ('board-column-compact'); + } else { + $('#board-container').addClass ('board-container-wide'); + $("#board th,#board td").addClass ('board-column-wide'); + } + } + jQuery(document).ready(function() { if (Kanboard.Exists("board")) { @@ -358,7 +391,13 @@ Kanboard.Board = (function() { filter_load_events(); stack_load_events(); keyboard_shortcuts(); + compactview_reload(); } }); + + // Reload the compactview states (shown/hidden) after an ajax call + jQuery(document).ajaxComplete(function() { + compactview_reload(); + }); })(); |