diff --git a/app/coffee/modules/backlog/main.coffee b/app/coffee/modules/backlog/main.coffee index 94e85059..e6b12d85 100644 --- a/app/coffee/modules/backlog/main.coffee +++ b/app/coffee/modules/backlog/main.coffee @@ -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() diff --git a/app/coffee/modules/common/loader.coffee b/app/coffee/modules/common/loader.coffee index f0266360..fdabe995 100644 --- a/app/coffee/modules/common/loader.coffee +++ b/app/coffee/modules/common/loader.coffee @@ -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: () -> diff --git a/app/coffee/modules/nav.coffee b/app/coffee/modules/nav.coffee index bb7ef375..dd4a961d 100644 --- a/app/coffee/modules/nav.coffee +++ b/app/coffee/modules/nav.coffee @@ -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}) diff --git a/app/coffee/modules/taskboard/charts.coffee b/app/coffee/modules/taskboard/charts.coffee index f1a4db65..872fe43e 100644 --- a/app/coffee/modules/taskboard/charts.coffee +++ b/app/coffee/modules/taskboard/charts.coffee @@ -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()