Merge pull request #8 from taigaio/set-timeout-cleaning

Set timeout cleaning
stable
David Barragán Merino 2014-09-04 10:14:59 +02:00
commit 89de60dad3
4 changed files with 24 additions and 25 deletions

View File

@ -26,6 +26,7 @@ toggleText = @.taiga.toggleText
scopeDefer = @.taiga.scopeDefer
bindOnce = @.taiga.bindOnce
groupBy = @.taiga.groupBy
timeout = @.taiga.timeout
module = angular.module("taigaBacklog")
@ -519,10 +520,9 @@ BacklogDirective = ($repo, $rootscope) ->
showHideFilter = ($scope, $el, $ctrl) ->
sidebar = $el.find("sidebar.filters-bar")
sidebar.one "transitionend", () ->
setTimeout ( ->
timeout 150, ->
$rootscope.$broadcast("resize")
$('.burndown').css("visibility", "visible")
), 150
target = angular.element("#show-filters-button")
$('.burndown').css("visibility", "hidden")
@ -542,7 +542,6 @@ BacklogDirective = ($repo, $rootscope) ->
event.preventDefault()
showHideFilter($scope, $el, $ctrl)
link = ($scope, $el, $attrs, $rootscope) ->
$ctrl = $el.controller()

View File

@ -26,6 +26,7 @@
taiga = @.taiga
sizeFormat = @.taiga.sizeFormat
timeout = @.taiga.timeout
module = angular.module("taigaCommon")
@ -90,18 +91,16 @@ Loader = () ->
pageLoaded = (force = false) ->
if startLoadTime
timeout = 0
timeoutValue = 0
if !force
endTime = new Date().getTime()
diff = endTime - startLoadTime
if diff < config.minTime
timeout = config.minTime - diff
timeoutValue = config.minTime - diff
setTimeout ( ->
$rootscope.$broadcast("loader:end")
), timeout
timeout(timeoutValue, -> $rootscope.$broadcast("loader:end"))
return {
reset: () ->

View File

@ -22,6 +22,7 @@
taiga = @.taiga
groupBy = @.taiga.groupBy
bindOnce = @.taiga.bindOnce
timeout = @.taiga.timeout
module = angular.module("taigaNavMenu", [])
@ -113,12 +114,12 @@ ProjectsNavigationDirective = ($rootscope, animationFrame, $timeout, tgLoader, $
hideMenu = () ->
if overlay.is(':visible')
difftime = new Date().getTime() - loadingStart
timeout = 0
timeoutValue = 0
if (difftime < 1000)
timeout = 1000 - timeout
timeoutValue = 1000 - timeoutValue
setTimeout ( ->
timeout timeoutValue, ->
overlay.one 'transitionend', () ->
overlay.hide()
@ -127,7 +128,6 @@ ProjectsNavigationDirective = ($rootscope, animationFrame, $timeout, tgLoader, $
.addClass("closed-projects-nav")
tgLoader.disablePreventLoading()
), timeout
renderProjects = ($el, projects) ->
html = projectsTemplate({projects: projects})

View File

@ -26,6 +26,7 @@ toggleText = @.taiga.toggleText
scopeDefer = @.taiga.scopeDefer
bindOnce = @.taiga.bindOnce
groupBy = @.taiga.groupBy
timeout = @.taiga.timeout
module = angular.module("taigaTaskboard")
@ -86,20 +87,20 @@ SprintGraphDirective = ->
link = ($scope, $el, $attrs) ->
element = angular.element($el)
$scope.$on "resize", ->
redrawChart(element, $scope.stats.days)
$scope.$on "taskboard:graph:toggle-visibility", ->
$el.parent().toggleClass('open')
# fix chart overflow
timeout(100, -> redrawChart(element, $scope.stats.days))
$scope.$watch 'stats', (value) ->
if $scope.stats?
redrawChart(element, $scope.stats.days)
$scope.$on "resize", ->
redrawChart(element, $scope.stats.days)
$scope.$on "taskboard:graph:toggle-visibility", ->
$el.parent().toggleClass('open')
#fix chart overflow
setTimeout ( ->
redrawChart(element, $scope.stats.days)
), 100
if not $scope.stats?
return
redrawChart(element, $scope.stats.days)
$scope.$on "$destroy", ->
$el.off()