commit
00cddb6bb6
|
@ -2,6 +2,7 @@ taiga = @.taiga
|
||||||
|
|
||||||
JoyRideDirective = ($rootScope, currentUserService, joyRideService, $location) ->
|
JoyRideDirective = ($rootScope, currentUserService, joyRideService, $location) ->
|
||||||
link = (scope, el, attrs, ctrl) ->
|
link = (scope, el, attrs, ctrl) ->
|
||||||
|
unsuscribe = null
|
||||||
intro = introJs()
|
intro = introJs()
|
||||||
|
|
||||||
#Todo: translate
|
#Todo: translate
|
||||||
|
@ -30,19 +31,21 @@ JoyRideDirective = ($rootScope, currentUserService, joyRideService, $location) -
|
||||||
intro.start()
|
intro.start()
|
||||||
|
|
||||||
$rootScope.$on '$routeChangeSuccess', (event, next) ->
|
$rootScope.$on '$routeChangeSuccess', (event, next) ->
|
||||||
return if !next.joyride ||
|
if !next.joyride || !currentUserService.isAuthenticated()
|
||||||
!currentUserService.isAuthenticated() ||
|
intro.exit()
|
||||||
$location.path() == '/error'
|
unsuscribe() if unsuscribe
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
intro.oncomplete () ->
|
intro.oncomplete () ->
|
||||||
currentUserService.disableJoyRide(next.joyride)
|
currentUserService.disableJoyRide(next.joyride)
|
||||||
|
|
||||||
if next.loader
|
if next.loader
|
||||||
un = $rootScope.$on 'loader:end', () ->
|
unsuscribe = $rootScope.$on 'loader:end', () ->
|
||||||
currentUserService.loadJoyRideConfig()
|
currentUserService.loadJoyRideConfig()
|
||||||
.then (config) -> initJoyrRide(next, config)
|
.then (config) -> initJoyrRide(next, config)
|
||||||
|
|
||||||
un()
|
unsuscribe()
|
||||||
else
|
else
|
||||||
currentUserService.loadJoyRideConfig()
|
currentUserService.loadJoyRideConfig()
|
||||||
.then (config) -> initJoyrRide(next, config)
|
.then (config) -> initJoyrRide(next, config)
|
||||||
|
|
Loading…
Reference in New Issue