Merge pull request #30 from taigaio/close-all-popups-when-redirecting-to-error-page
Closing all popups when redirecting to error pagestable
commit
59f05450ca
|
@ -136,10 +136,11 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, tgLoade
|
||||||
$httpProvider.defaults.headers.get = {}
|
$httpProvider.defaults.headers.get = {}
|
||||||
|
|
||||||
# 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, $confirm, $navUrls) ->
|
authHttpIntercept = ($q, $location, $confirm, $navUrls, $lightboxService) ->
|
||||||
return (promise) ->
|
return (promise) ->
|
||||||
return promise.then null, (response) ->
|
return promise.then null, (response) ->
|
||||||
if response.status == 0
|
if response.status == 0
|
||||||
|
$lightboxService.closeAll()
|
||||||
$location.path($navUrls.resolve("error"))
|
$location.path($navUrls.resolve("error"))
|
||||||
$location.replace()
|
$location.replace()
|
||||||
else if response.status == 401
|
else if response.status == 401
|
||||||
|
@ -147,7 +148,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, tgLoade
|
||||||
$location.url($navUrls.resolve("login")).search("next=#{nextPath}")
|
$location.url($navUrls.resolve("login")).search("next=#{nextPath}")
|
||||||
return $q.reject(response)
|
return $q.reject(response)
|
||||||
|
|
||||||
$provide.factory("authHttpIntercept", ["$q", "$location", "$tgConfirm", "$tgNavUrls", authHttpIntercept])
|
$provide.factory("authHttpIntercept", ["$q", "$location", "$tgConfirm", "$tgNavUrls", "lightboxService", authHttpIntercept])
|
||||||
$httpProvider.responseInterceptors.push('authHttpIntercept')
|
$httpProvider.responseInterceptors.push('authHttpIntercept')
|
||||||
$httpProvider.interceptors.push('loaderInterceptor')
|
$httpProvider.interceptors.push('loaderInterceptor')
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,12 @@ class LightboxService extends taiga.Service
|
||||||
|
|
||||||
$el.removeClass("open")
|
$el.removeClass("open")
|
||||||
|
|
||||||
|
closeAll: ->
|
||||||
|
docEl = angular.element(document)
|
||||||
|
for lightboxEl in docEl.find(".lightbox.open")
|
||||||
|
@.close($(lightboxEl))
|
||||||
|
|
||||||
|
|
||||||
module.service("lightboxService", LightboxService)
|
module.service("lightboxService", LightboxService)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue