diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index f531f504f..4a1b20afb 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -29,6 +29,16 @@ class App.Controller extends Spine.Controller ajaxId = App.Ajax.request(data) @ajaxCalls.push ajaxId + navigate: (location, hide_current_location_from_history = false) -> + @log 'notice', "navigate to '#{location}'" + + # hide current location from browser history, allow to use back button in browser + if hide_current_location_from_history + @log 'debug', "ignore new location from browser histroy '#{location}'" + if window.history + window.history.replaceState(null, null, location) + super location + bind: (event, callback) => App.Event.bind( event diff --git a/app/assets/javascripts/app/controllers/default_route.js.coffee b/app/assets/javascripts/app/controllers/default_route.js.coffee index a253a6222..e0e96218c 100644 --- a/app/assets/javascripts/app/controllers/default_route.js.coffee +++ b/app/assets/javascripts/app/controllers/default_route.js.coffee @@ -9,24 +9,24 @@ class Index extends App.Controller # check if import is active if !@Config.get('system_init_done') && @Config.get('import_mode') - @navigate '#import' + @navigate '#import', true return # route to getting started screen if !@Config.get('system_init_done') - @navigate '#getting_started' + @navigate '#getting_started', true return # check role if @isRole('Customer') - @navigate '#ticket/view/my_tickets' + @navigate '#ticket/view/my_tickets', true return if @Config.get('default_controller') - @navigate @Config.get('default_controller') + @navigate @Config.get('default_controller'), true return - @navigate '#dashboard' + @navigate '#dashboard', true App.Config.set( '', Index, 'Routes' ) App.Config.set( '/', Index, 'Routes' ) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index 6d39c03f4..9568e9d2b 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -88,7 +88,12 @@ class App.TicketZoom extends App.Controller '#ticket/zoom/' + @ticket_id show: (params) => - return if @activeState + + # if controller is executed twice, go to latest article + if @activeState + @scrollToBottom() + return + @activeState = true App.Event.trigger('ui::ticket::shown', { ticket_id: @ticket_id } ) diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee index 240d511a7..18e902637 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee @@ -93,6 +93,18 @@ class App.OnlineNotificationWidget extends App.Controller @hidePopover() ) + # execute controller again of already open (because hash hasn't changed, we need to do it manually) + $('.js-locationVerify').on('click', (e) => + newLocation = $(e.target).attr 'href' + if !newLocation + newLocation = $(e.target).closest('.js-locationVerify').attr 'href' + return if !newLocation + currentLocation = Spine.Route.getPath() + return if newLocation.replace(/#/, '') isnt currentLocation + @log 'debug', "execute controller again for '#{currentLocation}' because of same hash" + Spine.Route.matchRoutes(currentLocation) + ) + # mark all notifications as read $('.js-markAllAsRead').on('click', (e) => e.preventDefault() diff --git a/app/assets/javascripts/app/views/widget/online_notification_content.jst.eco b/app/assets/javascripts/app/views/widget/online_notification_content.jst.eco index b2a7c797f..31591a5f5 100644 --- a/app/assets/javascripts/app/views/widget/online_notification_content.jst.eco +++ b/app/assets/javascripts/app/views/widget/online_notification_content.jst.eco @@ -4,7 +4,7 @@ <%- item.created_by.avatar() %> - + <%= item.created_by.displayName() %> <%- @T( item.type ) %> <%- @T( item.object_name ) %><% if item.title: %> (<%= item.title %>)<% end %> diff --git a/app/controllers/sessions/collection_base.rb b/app/controllers/sessions/collection_base.rb index f4772bcf7..5bcfb5132 100644 --- a/app/controllers/sessions/collection_base.rb +++ b/app/controllers/sessions/collection_base.rb @@ -11,7 +11,7 @@ module ExtraCollection assets = item.assets(assets) } - collections[ OnlineNotification.to_app_model ] = OnlineNotification.list(user, 30) + collections[ OnlineNotification.to_app_model ] = OnlineNotification.list(user, 50) assets = ApplicationModel.assets_of_object_list(collections[ OnlineNotification.to_app_model ], assets) collections[ RecentView.to_app_model ] = RecentView.list(user, 10)