Kanban Table Width Recalculation on Squish Columns
parent
91c3b213e8
commit
f5c6031262
|
@ -276,30 +276,6 @@ KanbanDirective = ($repo, $rootscope) ->
|
||||||
module.directive("tgKanban", ["$tgRepo", "$rootScope", KanbanDirective])
|
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
|
## Kanban Column Height Fixer Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -366,16 +342,25 @@ module.directive("tgKanbanUserstory", ["$rootScope", KanbanUserstoryDirective])
|
||||||
|
|
||||||
KanbanSquishColumnDirective = (rs) ->
|
KanbanSquishColumnDirective = (rs) ->
|
||||||
|
|
||||||
#TODO: Only header is folding/unfolding so
|
|
||||||
# 1. Recalculate container width.
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
$scope.$on "project:loaded", (event, project) ->
|
$scope.$on "project:loaded", (event, project) ->
|
||||||
$scope.folds = rs.kanban.getStatusColumnModes(project.id)
|
$scope.folds = rs.kanban.getStatusColumnModes(project.id)
|
||||||
|
updateTableWidth()
|
||||||
|
|
||||||
$scope.foldStatus = (status) ->
|
$scope.foldStatus = (status) ->
|
||||||
$scope.folds[status.id] = !!!$scope.folds[status.id]
|
$scope.folds[status.id] = !!!$scope.folds[status.id]
|
||||||
rs.kanban.storeStatusColumnModes($scope.projectId, $scope.folds)
|
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}
|
return {link: link}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
div.kanban-table(tg-kanban-squish-column)
|
div.kanban-table(tg-kanban-squish-column)
|
||||||
div.kanban-table-header
|
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]}')
|
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")
|
span(tg-bo-bind="s.name")
|
||||||
div.options
|
div.options
|
||||||
|
|
Loading…
Reference in New Issue