summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorashbike <helloashbike@gmail.com>2015-02-28 14:31:20 +0530
committerashbike <helloashbike@gmail.com>2015-02-28 14:31:20 +0530
commit621b979627c19e41fc955d939615fc8b7779a2a9 (patch)
tree807dcc31a2bdc6ede08bcb09c6e7fc8fbf310ed8 /assets
parentdb59460da16bc607ae2e73838925bf3f6a95259d (diff)
parent106f45258c5018a811fb8e38ee7fb123da5f3459 (diff)
Added a menu item and short key 'c' to toggle board view. View modes are compact (tries to stuff all columns in the window) and wide (scrollbar appears)
Diffstat (limited to 'assets')
-rw-r--r--assets/css/src/board.css20
-rw-r--r--assets/js/src/board.js37
2 files changed, 57 insertions, 0 deletions
diff --git a/assets/css/src/board.css b/assets/css/src/board.css
index a1aa268d..21b53f57 100644
--- a/assets/css/src/board.css
+++ b/assets/css/src/board.css
@@ -20,16 +20,36 @@
/* board table */
#board-container {
+ /* Will set the style from JS depending upon wide/compact view */
+}
+
+/* Board container classes for wide/compact view */
+.board-container-wide {
overflow-x: scroll;
padding-bottom: 180px; /* Space to avoid dropdown menu truncated */
}
+.board-container-compact {
+ overflow-x: hidden;
+ padding-bottom: 180px; /* Space to avoid dropdown menu truncated */
+}
+
#board td,
#board th {
+ /* Will set the style from JS depending upon wide/compact view */
+ }
+
+/* Board table column for wide/compact view */
+.board-column-wide {
min-width: 240px;
max-width: 240px;
}
+.board-column-compact {
+ min-width: 0px;
+ max-width: 0px;
+}
+
#board th a {
text-decoration: none;
color: #3366CC;
diff --git a/assets/js/src/board.js b/assets/js/src/board.js
index 75c44f2e..ff1054cd 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,33 @@ 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()
+ {
+ if (Kanboard.GetStorageItem("compactview") == '1') {
+ $("#board-container").removeClass ("board-container-wide").addClass ("board-container-compact");
+ $("#board th,#board td").removeClass ("board-column-wide").addClass ("board-column-compact");
+ } else {
+ $("#board-container").removeClass ("board-container-compact").addClass ("board-container-wide");
+ $("#board th,#board td").removeClass ("board-column-compact").addClass ("board-column-wide");
+ }
+ }
+
jQuery(document).ready(function() {
if (Kanboard.Exists("board")) {
@@ -358,7 +389,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();
+ });
})();