From 4a6d25d375558f136c14aaa2124b98dacaa400f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Tue, 19 Aug 2014 12:37:16 +0200 Subject: [PATCH] Fix #707 with :poop: --- app/coffee/modules/nav.coffee | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/coffee/modules/nav.coffee b/app/coffee/modules/nav.coffee index 13296750..e97ed360 100644 --- a/app/coffee/modules/nav.coffee +++ b/app/coffee/modules/nav.coffee @@ -66,7 +66,7 @@ class ProjectsNavigationController extends taiga.Controller module.controller("ProjectsNavigationController", ProjectsNavigationController) -ProjectsNavigationDirective = ($rootscope, animationFrame, $timeout, tgLoader) -> +ProjectsNavigationDirective = ($rootscope, animationFrame, $timeout, tgLoader, $location) -> baseTemplate = _.template("""

Your projects

@@ -150,6 +150,16 @@ ProjectsNavigationDirective = ($rootscope, animationFrame, $timeout, tgLoader) - $(document.body).toggleClass("open-projects-nav") $el.on "click", ".projects-list > li > a", (event) -> + # HACK: to solve a problem with the loader when the next url + # is equal to the current one + target = angular.element(event.currentTarget) + nextUrl = target.prop("href") + currentUrl = $location.absUrl() + if nextUrl == currentUrl + hideMenu() + return + # END HACK + $(document.body) .addClass('loading-project') @@ -246,11 +256,10 @@ ProjectsNavigationDirective = ($rootscope, animationFrame, $timeout, tgLoader) - renderProjects($el, $scope.filteredProjects) renderNextAndPrev() - return { - link: link - } + return {link: link} -module.directive("tgProjectsNav", ["$rootScope", "animationFrame", "$timeout", "tgLoader", ProjectsNavigationDirective]) +module.directive("tgProjectsNav", ["$rootScope", "animationFrame", "$timeout", "tgLoader", "$location", + ProjectsNavigationDirective]) #############################################################################