[Backport] close lightbox if the user press the browswer back button
parent
c4488578a4
commit
4d793cf10f
|
@ -690,7 +690,7 @@ i18nInit = (lang, $translate) ->
|
|||
|
||||
|
||||
init = ($log, $rootscope, $auth, $events, $analytics, $translate, $location, $navUrls, appMetaService,
|
||||
loaderService, navigationBarService, errorHandlingService) ->
|
||||
loaderService, navigationBarService, errorHandlingService, lightboxService) ->
|
||||
$log.debug("Initialize application")
|
||||
|
||||
$rootscope.$on '$translatePartialLoaderStructureChanged', () ->
|
||||
|
@ -737,6 +737,11 @@ init = ($log, $rootscope, $auth, $events, $analytics, $translate, $location, $na
|
|||
$rootscope.$on '$locationChangeStart', (event) ->
|
||||
errorHandlingService.init()
|
||||
|
||||
if lightboxService.getLightboxOpen().length
|
||||
event.preventDefault();
|
||||
|
||||
lightboxService.closeAll()
|
||||
|
||||
# On the first page load the loader is painted in `$routeChangeSuccess`
|
||||
# because we need to hide the tg-navigation-bar.
|
||||
# In the other cases the loader is in `$routeChangeSuccess`
|
||||
|
@ -861,5 +866,6 @@ module.run([
|
|||
"tgLoader",
|
||||
"tgNavigationBarService",
|
||||
"tgErrorHandlingService",
|
||||
"lightboxService",
|
||||
init
|
||||
])
|
||||
|
|
|
@ -97,6 +97,10 @@ class LightboxService extends taiga.Service
|
|||
scope.$destroy() if scope
|
||||
$el.remove()
|
||||
|
||||
|
||||
getLightboxOpen: ->
|
||||
return $(".lightbox.open")
|
||||
|
||||
closeAll: ->
|
||||
docEl = angular.element(document)
|
||||
for lightboxEl in docEl.find(".lightbox.open")
|
||||
|
|
Loading…
Reference in New Issue