Kanban Table Width Recalculation on Squish Columns

stable
Xavier Julián 2014-11-17 15:59:31 +01:00
parent 91c3b213e8
commit f5c6031262
2 changed files with 13 additions and 28 deletions

View File

@ -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}

View File

@ -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