diff options
Diffstat (limited to 'assets/js/src')
-rw-r--r-- | assets/js/src/App.js | 7 | ||||
-rw-r--r-- | assets/js/src/BoardColumnScrolling.js | 85 | ||||
-rw-r--r-- | assets/js/src/BoardDragAndDrop.js | 8 | ||||
-rw-r--r-- | assets/js/src/Popover.js | 1 | ||||
-rw-r--r-- | assets/js/src/Task.js | 28 |
5 files changed, 33 insertions, 96 deletions
diff --git a/assets/js/src/App.js b/assets/js/src/App.js index cf630140..b85d5d3c 100644 --- a/assets/js/src/App.js +++ b/assets/js/src/App.js @@ -35,6 +35,7 @@ Kanboard.App.prototype.execute = function() { this.keyboardShortcuts(); this.datePicker(); this.autoComplete(); + this.tagAutoComplete(); }; Kanboard.App.prototype.keyboardShortcuts = function() { @@ -131,6 +132,12 @@ Kanboard.App.prototype.datePicker = function() { }); }; +Kanboard.App.prototype.tagAutoComplete = function() { + $(".tag-autocomplete").select2({ + tags: true + }) +}; + Kanboard.App.prototype.autoComplete = function() { $(".autocomplete").each(function() { var input = $(this); diff --git a/assets/js/src/BoardColumnScrolling.js b/assets/js/src/BoardColumnScrolling.js deleted file mode 100644 index e637180d..00000000 --- a/assets/js/src/BoardColumnScrolling.js +++ /dev/null @@ -1,85 +0,0 @@ -Kanboard.BoardColumnScrolling = function(app) { - this.app = app; -}; - -Kanboard.BoardColumnScrolling.prototype.execute = function() { - if (this.app.hasId("board")) { - this.render(); - - $(window).on("load", this.render); - $(window).resize(this.render); - } -}; - -Kanboard.BoardColumnScrolling.prototype.listen = function() { - var self = this; - - $(document).on('click', ".filter-toggle-height", function(e) { - e.preventDefault(); - self.toggle(); - }); -}; - -Kanboard.BoardColumnScrolling.prototype.onBoardRendered = function() { - this.render(); -}; - -Kanboard.BoardColumnScrolling.prototype.toggle = function() { - var scrolling = localStorage.getItem("column_scroll"); - - if (scrolling == undefined) { - scrolling = 1; - } - - localStorage.setItem("column_scroll", scrolling == 0 ? 1 : 0); - this.render(); -}; - -Kanboard.BoardColumnScrolling.prototype.render = function() { - var taskList = $(".board-task-list"); - var rotationWrapper = $(".board-rotation-wrapper"); - var filterMax = $(".filter-max-height"); - var filterMin = $(".filter-min-height"); - - if (localStorage.getItem("column_scroll") == 0) { - var height = 80; - - filterMax.show(); - filterMin.hide(); - rotationWrapper.css("min-height", ''); - - taskList.each(function() { - var columnHeight = $(this).height(); - - if (columnHeight > height) { - height = columnHeight; - } - }); - - taskList.css("min-height", height); - taskList.css("height", ''); - } - else { - - filterMax.hide(); - filterMin.show(); - - if ($(".board-swimlane").length > 1) { - taskList.each(function() { - if ($(this).height() > 500) { - $(this).css("height", 500); - } - else { - $(this).css("min-height", 320); // Height of the dropdown menu - rotationWrapper.css("min-height", 320); - } - }); - } - else { - var height = $(window).height() - 170; - - taskList.css("height", height); - rotationWrapper.css("min-height", height); - } - } -}; diff --git a/assets/js/src/BoardDragAndDrop.js b/assets/js/src/BoardDragAndDrop.js index 4d2ae3ec..c8e24444 100644 --- a/assets/js/src/BoardDragAndDrop.js +++ b/assets/js/src/BoardDragAndDrop.js @@ -12,6 +12,7 @@ Kanboard.BoardDragAndDrop.prototype.execute = function() { Kanboard.BoardDragAndDrop.prototype.dragAndDrop = function() { var self = this; + var dropzone = $(".board-task-list"); var params = { forcePlaceholderSize: true, tolerance: "pointer", @@ -47,7 +48,12 @@ Kanboard.BoardDragAndDrop.prototype.dragAndDrop = function() { params["handle"] = ".task-board-sort-handle"; } - $(".board-task-list").sortable(params); + // Set dropzone height to the height of the table cell + dropzone.each(function() { + $(this).css("min-height", $(this).parent().height()); + }); + + dropzone.sortable(params); }; Kanboard.BoardDragAndDrop.prototype.changeTaskState = function(taskId) { diff --git a/assets/js/src/Popover.js b/assets/js/src/Popover.js index e5e8ea81..273916ea 100644 --- a/assets/js/src/Popover.js +++ b/assets/js/src/Popover.js @@ -147,4 +147,5 @@ Kanboard.Popover.prototype.afterOpen = function() { this.app.datePicker(); this.app.autoComplete(); + this.app.tagAutoComplete(); }; diff --git a/assets/js/src/Task.js b/assets/js/src/Task.js index e19e6b2d..06419207 100644 --- a/assets/js/src/Task.js +++ b/assets/js/src/Task.js @@ -11,10 +11,6 @@ Kanboard.Task.prototype.keyboardShortcuts = function() { self.app.get("Popover").open(taskView.data("edit-url")); }); - Mousetrap.bind("d", function() { - self.app.get("Popover").open(taskView.data("description-url")); - }); - Mousetrap.bind("c", function() { self.app.get("Popover").open(taskView.data("comment-url")); }); @@ -33,12 +29,7 @@ Kanboard.Task.prototype.onPopoverOpened = function() { var self = this; var reloadingProjectId = 0; - // Change color - $(document).on("click", ".color-square", function() { - $(".color-square-selected").removeClass("color-square-selected"); - $(this).addClass("color-square-selected"); - $("#form-color_id").val($(this).data("color-id")); - }); + self.renderColorPicker(); // Assign to me $(document).on("click", ".assign-me", function(e) { @@ -75,3 +66,20 @@ Kanboard.Task.prototype.onPopoverOpened = function() { } }); }; + +Kanboard.Task.prototype.renderColorPicker = function() { + function renderColorOption(color) { + return $( + '<div class="color-picker-option">' + + '<div class="color-picker-square color-' + color.id + '"></div>' + + '<div class="color-picker-label">' + color.text + '</div>' + + '</div>' + ); + } + + $(".color-picker").select2({ + minimumResultsForSearch: Infinity, + templateResult: renderColorOption, + templateSelection: renderColorOption + }); +}; |