diff options
author | Max Kamashev <kamashev@gollard.ru> | 2015-09-30 09:19:33 +0300 |
---|---|---|
committer | Max Kamashev <kamashev@gollard.ru> | 2015-09-30 09:19:33 +0300 |
commit | cabcdc9d9e58d279ac6a5992ae5202568ed4d24e (patch) | |
tree | eebdc4ec16eb7dc2ed0edd953321fa3e02869f34 /assets/js/src | |
parent | 930406bf70e42413a83114b9530b3f63ccf9419f (diff) | |
parent | 421e8751ebca5b566ecbd8d08e9d56b93ce81ffa (diff) |
Merge branch 'master' of https://github.com/fguillot/kanboard into 1245_bug_with_subtask_timer
Diffstat (limited to 'assets/js/src')
-rw-r--r-- | assets/js/src/Board.js | 70 | ||||
-rw-r--r-- | assets/js/src/Popover.js | 11 | ||||
-rw-r--r-- | assets/js/src/Search.js | 6 | ||||
-rw-r--r-- | assets/js/src/Swimlane.js | 6 |
4 files changed, 65 insertions, 28 deletions
diff --git a/assets/js/src/Board.js b/assets/js/src/Board.js index 8d732c53..5370344c 100644 --- a/assets/js/src/Board.js +++ b/assets/js/src/Board.js @@ -8,13 +8,13 @@ Board.prototype.execute = function() { this.app.swimlane.listen(); this.restoreColumnViewMode(); this.compactView(); + this.columnScrolling(); this.poll(); this.keyboardShortcuts(); - this.resizeColumnHeight(); this.listen(); this.dragAndDrop(); - $(window).resize(this.resizeColumnHeight); + $(window).resize(this.columnScrolling); }; Board.prototype.poll = function() { @@ -85,7 +85,7 @@ Board.prototype.refresh = function(data) { this.app.refresh(); this.app.swimlane.refresh(); this.app.swimlane.listen(); - this.resizeColumnHeight(); + this.columnScrolling(); this.app.hideLoadingIcon(); this.listen(); this.dragAndDrop(); @@ -93,22 +93,6 @@ Board.prototype.refresh = function(data) { this.restoreColumnViewMode(); }; -Board.prototype.resizeColumnHeight = function() { - if ($(".board-swimlane").length > 1) { - $(".board-task-list").each(function() { - if ($(this).height() > 500) { - $(this).height(500); - } - else { - $(this).css("min-height", 320); // Min height is the height of the menu dropdown - } - }); - } - else { - $(".board-task-list").height($(window).height() - 145); - } -}; - Board.prototype.dragAndDrop = function() { var self = this; var params = { @@ -155,11 +139,58 @@ Board.prototype.listen = function() { self.toggleCompactView(); }); + $(document).on('click', ".filter-toggle-height", function(e) { + e.preventDefault(); + self.toggleColumnScrolling(); + }); + $(document).on("click", ".board-column-title", function() { self.toggleColumnViewMode($(this).data("column-id")); }); }; +Board.prototype.toggleColumnScrolling = function() { + var scrolling = localStorage.getItem("column_scroll") || 1; + localStorage.setItem("column_scroll", scrolling == 0 ? 1 : 0); + this.columnScrolling(); +}; + +Board.prototype.columnScrolling = function() { + if (localStorage.getItem("column_scroll") == 0) { + $(".filter-max-height").show(); + $(".filter-min-height").hide(); + + $(".board-task-list").each(function() { + $(this).css("min-height", 80); + $(this).css("height", ''); + $(".board-rotation-wrapper").css("min-height", ''); + }); + } + else { + + $(".filter-max-height").hide(); + $(".filter-min-height").show(); + + if ($(".board-swimlane").length > 1) { + $(".board-task-list").each(function() { + if ($(this).height() > 500) { + $(this).css("height", 500); + } + else { + $(this).css("min-height", 320); // Height of the dropdown menu + $(".board-rotation-wrapper").css("min-height", 320); + } + }); + } + else { + var height = $(window).height() - 145; + + $(".board-task-list").css("height", height); + $(".board-rotation-wrapper").css("min-height", height); + } + } +}; + Board.prototype.toggleCompactView = function() { var scrolling = localStorage.getItem("horizontal_scroll") || 1; localStorage.setItem("horizontal_scroll", scrolling == 0 ? 1 : 0); @@ -233,7 +264,6 @@ Board.prototype.hideColumn = function(columnId) { }); $(".board-column-" + columnId + " .board-rotation").each(function() { - var position = $(".board-swimlane").position(); $(this).css("width", $(".board-column-" + columnId + "").height()); }); diff --git a/assets/js/src/Popover.js b/assets/js/src/Popover.js index b978c087..e5bc1c88 100644 --- a/assets/js/src/Popover.js +++ b/assets/js/src/Popover.js @@ -21,11 +21,14 @@ Popover.prototype.open = function(link) { }; Popover.prototype.close = function(e) { - if (e) { - e.preventDefault(); - } + if (this.isOpen()) { + + if (e) { + e.preventDefault(); + } - $('#popover-container').remove(); + $('#popover-container').remove(); + } }; Popover.prototype.onClick = function(e) { diff --git a/assets/js/src/Search.js b/assets/js/src/Search.js index acacbaf9..1e7e294a 100644 --- a/assets/js/src/Search.js +++ b/assets/js/src/Search.js @@ -18,7 +18,13 @@ Search.prototype.listen = function() { // Filter helper for search $(document).on("click", ".filter-helper", function (e) { e.preventDefault(); + var filter = $(this).data("filter"); + var appendFilter = $(this).data("append-filter"); + + if (appendFilter) { + filter = $("#form-search").val() + " " + appendFilter; + } $("#form-search").val(filter); diff --git a/assets/js/src/Swimlane.js b/assets/js/src/Swimlane.js index 0edb4821..8dfc9d45 100644 --- a/assets/js/src/Swimlane.js +++ b/assets/js/src/Swimlane.js @@ -16,9 +16,8 @@ Swimlane.prototype.expand = function(swimlaneId) { localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds)); $('.swimlane-row-' + swimlaneId).css('display', 'table-row'); - $('.show-icon-swimlane-' + swimlaneId).css('display', 'none'); $('.hide-icon-swimlane-' + swimlaneId).css('display', 'inline'); - $('.swimlane-task-count-' + swimlaneId).css('display', 'inline'); + $('.show-icon-swimlane-' + swimlaneId).css('display', 'none'); }; Swimlane.prototype.collapse = function(swimlaneId) { @@ -30,9 +29,8 @@ Swimlane.prototype.collapse = function(swimlaneId) { } $('.swimlane-row-' + swimlaneId).css('display', 'none'); - $('.show-icon-swimlane-' + swimlaneId).css('display', 'inline'); $('.hide-icon-swimlane-' + swimlaneId).css('display', 'none'); - $('.swimlane-task-count-' + swimlaneId).css('display', 'none'); + $('.show-icon-swimlane-' + swimlaneId).css('display', 'inline'); }; Swimlane.prototype.isCollapsed = function(swimlaneId) { |