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

View File

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

View File

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

View File

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