Merge pull request #682 from taigaio/issue/3368/prevent-joyride-in-error-pages

prevent joyride in error pages
stable
David Barragán Merino 2015-10-23 13:04:50 +02:00
commit d97d1336c2
2 changed files with 7 additions and 4 deletions

View File

@ -430,7 +430,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
# Add next param when user try to access to a secction need auth permissions. # Add next param when user try to access to a secction need auth permissions.
authHttpIntercept = ($q, $location, $navUrls, $lightboxService) -> authHttpIntercept = ($q, $location, $navUrls, $lightboxService) ->
httpResponseError = (response) -> httpResponseError = (response) ->
if response.status == 0 if response.status == 0 || response.status == -1
$lightboxService.closeAll() $lightboxService.closeAll()
$location.path($navUrls.resolve("error")) $location.path($navUrls.resolve("error"))
$location.replace() $location.replace()

View File

@ -1,6 +1,6 @@
taiga = @.taiga taiga = @.taiga
JoyRideDirective = ($rootScope, currentUserService, joyRideService) -> JoyRideDirective = ($rootScope, currentUserService, joyRideService, $location) ->
link = (scope, el, attrs, ctrl) -> link = (scope, el, attrs, ctrl) ->
intro = introJs() intro = introJs()
@ -30,7 +30,9 @@ JoyRideDirective = ($rootScope, currentUserService, joyRideService) ->
intro.start() intro.start()
$rootScope.$on '$routeChangeSuccess', (event, next) -> $rootScope.$on '$routeChangeSuccess', (event, next) ->
return if !next.joyride || !currentUserService.isAuthenticated() return if !next.joyride ||
!currentUserService.isAuthenticated() ||
$location.path() == '/error'
intro.oncomplete () -> intro.oncomplete () ->
currentUserService.disableJoyRide(next.joyride) currentUserService.disableJoyRide(next.joyride)
@ -53,7 +55,8 @@ JoyRideDirective = ($rootScope, currentUserService, joyRideService) ->
JoyRideDirective.$inject = [ JoyRideDirective.$inject = [
"$rootScope", "$rootScope",
"tgCurrentUserService", "tgCurrentUserService",
"tgJoyRideService" "tgJoyRideService",
"$location"
] ]
angular.module("taigaComponents").directive("tgJoyRide", JoyRideDirective) angular.module("taigaComponents").directive("tgJoyRide", JoyRideDirective)