diff --git a/app/coffee/modules/kanban/main.coffee b/app/coffee/modules/kanban/main.coffee index e0f2a740..c05c95b5 100644 --- a/app/coffee/modules/kanban/main.coffee +++ b/app/coffee/modules/kanban/main.coffee @@ -276,30 +276,6 @@ KanbanDirective = ($repo, $rootscope) -> module.directive("tgKanban", ["$tgRepo", "$rootScope", KanbanDirective]) -############################################################################# -## Kanban Row Size Fixer Directive -############################################################################# - -KanbanRowWidthFixerDirective = -> - link = ($scope, $el, $attrs) -> - bindOnce $scope, "usStatusList", (statuses) -> - columnWidths = _.map statuses, (status) -> - if $scope.folds[status.id] - return 40 - else - return 310 - totalWidth = _.reduce columnWidths, (total, width) -> - return total + width - $el.css("width", totalWidth) - - $scope.$on "$destroy", -> - $el.off() - - return {link: link} - -module.directive("tgKanbanRowWidthFixer", KanbanRowWidthFixerDirective) - - ############################################################################# ## Kanban Column Height Fixer Directive ############################################################################# @@ -366,16 +342,25 @@ module.directive("tgKanbanUserstory", ["$rootScope", KanbanUserstoryDirective]) KanbanSquishColumnDirective = (rs) -> - #TODO: Only header is folding/unfolding so - # 1. Recalculate container width. - link = ($scope, $el, $attrs) -> $scope.$on "project:loaded", (event, project) -> $scope.folds = rs.kanban.getStatusColumnModes(project.id) + updateTableWidth() $scope.foldStatus = (status) -> $scope.folds[status.id] = !!!$scope.folds[status.id] rs.kanban.storeStatusColumnModes($scope.projectId, $scope.folds) + updateTableWidth() + + updateTableWidth = -> + columnWidths = _.map $scope.usStatusList, (status) -> + if $scope.folds[status.id] + return 40 + else + return 310 + totalWidth = _.reduce columnWidths, (total, width) -> + return total + width + $el.find('.kanban-table-inner').css("width", totalWidth) return {link: link} diff --git a/app/partials/views/modules/kanban-table.jade b/app/partials/views/modules/kanban-table.jade index 384643f1..ea3d6baf 100644 --- a/app/partials/views/modules/kanban-table.jade +++ b/app/partials/views/modules/kanban-table.jade @@ -1,6 +1,6 @@ div.kanban-table(tg-kanban-squish-column) div.kanban-table-header - div.kanban-table-inner(tg-kanban-row-width-fixer) + div.kanban-table-inner h2.task-colum-name(ng-repeat="s in usStatusList track by s.id", ng-style="{'border-top-color':s.color}", tg-bo-title="s.name", ng-class='{vfold:folds[s.id]}') span(tg-bo-bind="s.name") div.options