Split column size code from kanban sortable directive into an other specific directive.

stable
Andrey Antukh 2014-09-12 20:23:10 +02:00
parent be2872bd8f
commit fed86f8d4f
3 changed files with 23 additions and 9 deletions

View File

@ -245,6 +245,26 @@ KanbanRowSizeFixer = ->
module.directive("tgKanbanRowSizeFixer", KanbanRowSizeFixer)
#############################################################################
## Kaban Column Height Fixer Directive
#############################################################################
KanbanColumnHeightFixerDirective = ->
mainPadding = 32 # px
renderSize = ($el) ->
elementOffset = $el.parent().parent().offset().top
windowHeight = angular.element(window).height()
columnHeight = windowHeight - elementOffset - mainPadding
$el.css("height", "#{columnHeight}px")
link = ($scope, $el, $attrs) ->
timeout(500, -> renderSize($el))
return {link:link}
module.directive("tgKanbanColumnHeightFixer", KanbanColumnHeightFixerDirective)
#############################################################################
## Kaban User Story Directive

View File

@ -37,14 +37,6 @@ module = angular.module("taigaKanban")
KanbanSortableDirective = ($repo, $rs, $rootscope) ->
link = ($scope, $el, $attrs) ->
timeout 500, ->
mainPadding = 32 # px
elementOffset = $el.parent().parent().offset().top
windowHeight = angular.element(window).height()
columnHeight = windowHeight - elementOffset - mainPadding
$el.css("height", "#{columnHeight}px")
oldParentScope = null
newParentScope = null
itemEl = null

View File

@ -10,6 +10,8 @@ div.kanban-table
div.kanban-table-body
div.kanban-table-inner(tg-kanban-row-size-fixer)
div.kanban-uses-box.task-column(ng-repeat="status in usStatusList track by status.id",
tg-kanban-sortable, tg-kanban-wip-limit)
tg-kanban-sortable,
tg-kanban-wip-limit,
tg-kanban-column-height-fixer)
div.kanban-task(ng-repeat="us in usByStatus[status.id] track by us.id",
tg-kanban-userstory, ng-model="us")