diff --git a/app/assets/javascripts/app/controllers/_application_controller.coffee b/app/assets/javascripts/app/controllers/_application_controller.coffee index 9ae7aa129..7dd9a85bf 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.coffee @@ -550,21 +550,25 @@ class App.Controller extends Spine.Controller 'meta-task-update' ) - locationVerify: (e, callback) => + locationVerify: (e) => newLocation = $(e.currentTarget).attr 'href' - @log 'debug', "new location #{newLocation}" + @log 'debug', "new location '#{newLocation}'" return if !newLocation - currentLocation = Spine.Route.getPath() - @log 'debug', "current location #{currentLocation}" - return if newLocation.replace(/#/, '') isnt currentLocation - @locationExecute(newLocation, callback) + @locationExecuteOrNavigate(newLocation) - locationExecute: (location, callback) => - if callback - callback() - location = location.replace(/#/, '') - @log 'debug', "execute controller again for '#{location}' because of same hash" - Spine.Route.matchRoutes(location) + locationExecuteOrNavigate: (newLocation) => + currentLocation = Spine.Route.getPath() + @log 'debug', "current location '#{currentLocation}'" + if newLocation.replace(/#/, '') isnt currentLocation + @log 'debug', "navigate to location '#{newLocation}'" + @navigate(newLocation) + return + @locationExecute(newLocation) + + locationExecute: (newLocation) => + newLocation = newLocation.replace(/#/, '') + @log 'debug', "execute controller again for '#{newLocation}' because of same hash" + Spine.Route.matchRoutes(newLocation) logoUrl: -> "#{@Config.get('image_path')}/#{@Config.get('product_logo')}" diff --git a/app/assets/javascripts/app/controllers/widget/notify.coffee b/app/assets/javascripts/app/controllers/widget/notify.coffee index 7baedd4a1..078548183 100644 --- a/app/assets/javascripts/app/controllers/widget/notify.coffee +++ b/app/assets/javascripts/app/controllers/widget/notify.coffee @@ -29,14 +29,16 @@ class App.Notify extends App.ControllerWidgetPermanent counter = @desktopNotifyCounter notification = new window.Notification(data.title, data) @desktopNotify[counter] = notification + @log 'debug', 'notifyDesktop', data, counter notification.onclose = (e) => delete @desktopNotify[counter] notification.onclick = (e) => window.focus() + @log 'debug', 'notifyDesktop.click', data if data.url - @locationExecute(data.url) + @locationExecuteOrNavigate(data.url) if data.callback data.callback() diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.coffee index bf93ac964..872a55644 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.coffee @@ -150,7 +150,8 @@ class App.OnlineNotificationWidget extends App.Controller # execute controller again of already open (because hash hasn't changed, we need to do it manually) notificationsContainer.find('.js-locationVerify').on('click', (e) => - @locationVerify(e, @hidePopover) + @locationVerify(e) + @hidePopover() ) # close notification list on click