diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index 803a08980..15f424c39 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -216,6 +216,15 @@ class App.Controller extends Spine.Controller ticketPopups: (position = 'right') -> + # open ticket in new task if curent user agent + if @isRole('Agent') + @el.find('div.ticket-popover, span.ticket-popover').bind('click', (e) => + id = $(e.target).data('id') + if id + ticket = App.Ticket.find(id) + @navigate ticket.uiUrl() + ); + @ticketPopupsDestroy() # show ticket popup @@ -245,11 +254,13 @@ class App.Controller extends Spine.Controller userPopups: (position = 'right') -> - # open user in new task if user isn't customer - if !@isRole('Customer') - @el.find('.user-popover').bind('click', (e) => - user_id = $(e.target).data('id') - @navigate "#user/profile/#{user_id}" + # open user in new task if current user is agent + if @isRole('Agent') + @el.find('div.user-popover, span.user-popover').bind('click', (e) => + id = $(e.target).data('id') + if id + user = App.User.find(id) + @navigate user.uiUrl() ); @userPopupsDestroy() @@ -260,7 +271,7 @@ class App.Controller extends Spine.Controller container: 'body' html: true delay: { show: 400, hide: 400 } - placement: position + placement: "auto #{position}" title: -> user_id = $(@).data('id') user = App.User.fullLocal( user_id ) @@ -299,6 +310,15 @@ class App.Controller extends Spine.Controller organizationPopups: (position = 'right') -> + # open org in new task if current user agent + if @isRole('Agent') + @el.find('div.organization-popover, span.organization-popover').bind('click', (e) => + id = $(e.target).data('id') + if id + organization = App.Organization.find(id) + @navigate organization.uiUrl() + ); + @organizationPopupsDestroy() # show organization popup @@ -307,7 +327,7 @@ class App.Controller extends Spine.Controller container: 'body' html: true delay: { show: 400, hide: 400 } - placement: position + placement: "auto #{position}" title: -> organization_id = $(@).data('id') organization = App.Organization.fullLocal( organization_id ) @@ -360,7 +380,7 @@ class App.Controller extends Spine.Controller container: 'body' html: true delay: { show: 500, hide: 5200 } - placement: data.position + placement: "auto #{data.position}" title: -> $(@).find('[title="*"]').val() diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index df5f661a0..58778d835 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -89,11 +89,6 @@ class App.Navigation extends App.Controller renderResult: (result = []) => el = @$('#global-search-result') - # destroy existing popovers - @ticketPopupsDestroy() - @userPopupsDestroy() - @organizationPopupsDestroy() - # remove result if not result exists if _.isEmpty( result ) @$('.search').removeClass('open') diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee index e31f1c11f..95370c322 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee @@ -227,10 +227,14 @@ class _taskManagerSingleton extends App.Controller controller = @workers[ key ] if controller if key is thisKey + + # execute controllers show if controller.show controller.show(params_app) App.Event.trigger('ui:rerender:task') else + + # execute controllers hide if controller.hide controller.hide()