fix sprint progress bar directive
parent
d3b8aec8ab
commit
ffed61dfeb
|
@ -54,7 +54,12 @@ BacklogSprintDirective = ($repo, $rootscope) ->
|
||||||
# Update progress bars
|
# Update progress bars
|
||||||
$scope.$watch $attrs.tgBacklogSprint, (value) ->
|
$scope.$watch $attrs.tgBacklogSprint, (value) ->
|
||||||
sprint = $scope.$eval($attrs.tgBacklogSprint)
|
sprint = $scope.$eval($attrs.tgBacklogSprint)
|
||||||
progressPercentage = Math.round(100 * (sprint.closed_points / sprint.total_points))
|
|
||||||
|
if sprint.total_points
|
||||||
|
progressPercentage = Math.round(100 * (sprint.closed_points / sprint.total_points))
|
||||||
|
else
|
||||||
|
progressPercentage = 0
|
||||||
|
|
||||||
$el.find(".current-progress").css("width", "#{progressPercentage}%")
|
$el.find(".current-progress").css("width", "#{progressPercentage}%")
|
||||||
|
|
||||||
$el.find(".sprint-table").disableSelection()
|
$el.find(".sprint-table").disableSelection()
|
||||||
|
|
|
@ -46,6 +46,35 @@ DateRangeDirective = ->
|
||||||
module.directive("tgDateRange", DateRangeDirective)
|
module.directive("tgDateRange", DateRangeDirective)
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## Sprint Progress Bar Directive
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
SprintProgressBarDirective = ->
|
||||||
|
renderProgress = ($el, percentage, visual_percentage) ->
|
||||||
|
if $el.hasClass(".current-progress")
|
||||||
|
$el.css("width", "#{percentage}%")
|
||||||
|
else
|
||||||
|
$el.find(".current-progress").css("width", "#{visual_percentage}%")
|
||||||
|
$el.find(".number").html("#{percentage} %")
|
||||||
|
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
bindOnce $scope, $attrs.tgSprintProgressbar, (sprint) ->
|
||||||
|
closedPoints = sprint.closed_points
|
||||||
|
totalPoints = sprint.total_points
|
||||||
|
percentage = 0
|
||||||
|
percentage = Math.round(100 * (closedPoints/totalPoints)) if totalPoints != 0
|
||||||
|
visual_percentage = 0
|
||||||
|
#Visual hack for .current-progress bar
|
||||||
|
visual_percentage = Math.round(98 * (closedPoints/totalPoints)) if totalPoints != 0
|
||||||
|
|
||||||
|
renderProgress($el, percentage, visual_percentage)
|
||||||
|
|
||||||
|
return {link: link}
|
||||||
|
|
||||||
|
module.directive("tgSprintProgressbar", SprintProgressBarDirective)
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Date Selector Directive (using pikaday)
|
## Date Selector Directive (using pikaday)
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
Loading…
Reference in New Issue