From f4575e0f11a676ca434216e87d444ea608837540 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Thu, 7 Aug 2014 14:15:41 +0200 Subject: [PATCH] fix #278 --- app/coffee/modules/backlog/main.coffee | 12 +++++++++-- app/coffee/modules/common.coffee | 29 ++++++++++++++++++++++++++ app/coffee/modules/nav.coffee | 11 +++++----- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/app/coffee/modules/backlog/main.coffee b/app/coffee/modules/backlog/main.coffee index d87adff7..964f3df8 100644 --- a/app/coffee/modules/backlog/main.coffee +++ b/app/coffee/modules/backlog/main.coffee @@ -479,11 +479,19 @@ BacklogDirective = ($repo, $rootscope) -> $scope.filtersSearch = {} $el.on "click", "#show-filters-button", (event) -> event.preventDefault() + + sidebar = $el.find("sidebar.filters-bar") + sidebar.one "transitionend", () -> + setTimeout ( -> + $rootscope.$broadcast("resize") + $('.burndown').css("visibility", "visible") + ), 150 + target = angular.element(event.currentTarget) - $el.find("sidebar.filters-bar").toggleClass("active") + $('.burndown').css("visibility", "hidden") + sidebar.toggleClass("active") target.toggleClass("active") toggleText(target.find(".text"), ["Hide Filters", "Show Filters"]) # TODO: i18n - $rootscope.$broadcast("resize") link = ($scope, $el, $attrs, $rootscope) -> $ctrl = $el.controller() diff --git a/app/coffee/modules/common.coffee b/app/coffee/modules/common.coffee index 641fc3c9..63a63282 100644 --- a/app/coffee/modules/common.coffee +++ b/app/coffee/modules/common.coffee @@ -367,3 +367,32 @@ CheckPermissionDirective = -> return {link:link} module.directive("tgCheckPermission", CheckPermissionDirective) + +############################################################################# +## Animation frame service, apply css changes in the next render frame +############################################################################# +AnimationFrame = () -> + animationFrame = + window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame + + performAnimation = (time) => + fn = tail.shift() + fn() + + if (tail.length) + animationFrame(performAnimation) + + tail = [] + + add = () -> + for fn in arguments + tail.push(fn) + + if tail.length == 1 + animationFrame(performAnimation) + + return {add: add} + +module.factory("animationFrame", AnimationFrame) diff --git a/app/coffee/modules/nav.coffee b/app/coffee/modules/nav.coffee index cb232195..f61bca90 100644 --- a/app/coffee/modules/nav.coffee +++ b/app/coffee/modules/nav.coffee @@ -43,7 +43,7 @@ class ProjectsNavigationController extends taiga.Controller return projects -ProjectsNavigationDirective = ($rootscope) -> +ProjectsNavigationDirective = ($rootscope, animationFrame) -> overlay = $(".projects-nav-overlay") loadingStart = 0 hideMenu = () -> @@ -70,12 +70,11 @@ ProjectsNavigationDirective = ($rootscope) -> $scope.$on "nav:projects-list:open", -> if !$(document.body).hasClass("open-projects-nav") - overlay.show() + animationFrame.add () -> + overlay.show() - #animation hack - setTimeout ( -> + animationFrame.add () -> $(document.body).toggleClass("open-projects-nav") - ), 61 $el.on "click", ".projects-list > li > a", (event) -> $(document.body) @@ -89,7 +88,7 @@ ProjectsNavigationDirective = ($rootscope) -> } -module.directive("tgProjectsNav", ["$rootScope", ProjectsNavigationDirective]) +module.directive("tgProjectsNav", ["$rootScope", "animationFrame", ProjectsNavigationDirective]) #############################################################################