summaryrefslogtreecommitdiff
path: root/assets/js/src/board.js
diff options
context:
space:
mode:
authorashbike <helloashbike@gmail.com>2015-02-25 12:05:14 +0530
committerashbike <helloashbike@gmail.com>2015-02-25 12:05:14 +0530
commit88444e8b3e35e460e47cda0080957641071a2a6c (patch)
tree6cfe8d5bbf3410882cb15686fb27ff143c4616c9 /assets/js/src/board.js
parent11d1314fbe96c8f19d898cf18dc615a49a89fd0d (diff)
A small patch which enables scroll view toggling.
If there are many columns, the board adds a horizontal scrollbar. However, This looses the full board visibility. Now there is a menu item on the Board, Action > Toggle view which switches. This can also be toggled by 'c' keypress.
Diffstat (limited to 'assets/js/src/board.js')
-rw-r--r--assets/js/src/board.js39
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();
+ });
})();