Cleanup of use of popovers.
This commit is contained in:
parent
649cf8af10
commit
b43f9f9164
3 changed files with 32 additions and 13 deletions
|
@ -216,6 +216,15 @@ class App.Controller extends Spine.Controller
|
||||||
|
|
||||||
ticketPopups: (position = 'right') ->
|
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()
|
@ticketPopupsDestroy()
|
||||||
|
|
||||||
# show ticket popup
|
# show ticket popup
|
||||||
|
@ -245,11 +254,13 @@ class App.Controller extends Spine.Controller
|
||||||
|
|
||||||
userPopups: (position = 'right') ->
|
userPopups: (position = 'right') ->
|
||||||
|
|
||||||
# open user in new task if user isn't customer
|
# open user in new task if current user is agent
|
||||||
if !@isRole('Customer')
|
if @isRole('Agent')
|
||||||
@el.find('.user-popover').bind('click', (e) =>
|
@el.find('div.user-popover, span.user-popover').bind('click', (e) =>
|
||||||
user_id = $(e.target).data('id')
|
id = $(e.target).data('id')
|
||||||
@navigate "#user/profile/#{user_id}"
|
if id
|
||||||
|
user = App.User.find(id)
|
||||||
|
@navigate user.uiUrl()
|
||||||
);
|
);
|
||||||
|
|
||||||
@userPopupsDestroy()
|
@userPopupsDestroy()
|
||||||
|
@ -260,7 +271,7 @@ class App.Controller extends Spine.Controller
|
||||||
container: 'body'
|
container: 'body'
|
||||||
html: true
|
html: true
|
||||||
delay: { show: 400, hide: 400 }
|
delay: { show: 400, hide: 400 }
|
||||||
placement: position
|
placement: "auto #{position}"
|
||||||
title: ->
|
title: ->
|
||||||
user_id = $(@).data('id')
|
user_id = $(@).data('id')
|
||||||
user = App.User.fullLocal( user_id )
|
user = App.User.fullLocal( user_id )
|
||||||
|
@ -299,6 +310,15 @@ class App.Controller extends Spine.Controller
|
||||||
|
|
||||||
organizationPopups: (position = 'right') ->
|
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()
|
@organizationPopupsDestroy()
|
||||||
|
|
||||||
# show organization popup
|
# show organization popup
|
||||||
|
@ -307,7 +327,7 @@ class App.Controller extends Spine.Controller
|
||||||
container: 'body'
|
container: 'body'
|
||||||
html: true
|
html: true
|
||||||
delay: { show: 400, hide: 400 }
|
delay: { show: 400, hide: 400 }
|
||||||
placement: position
|
placement: "auto #{position}"
|
||||||
title: ->
|
title: ->
|
||||||
organization_id = $(@).data('id')
|
organization_id = $(@).data('id')
|
||||||
organization = App.Organization.fullLocal( organization_id )
|
organization = App.Organization.fullLocal( organization_id )
|
||||||
|
@ -360,7 +380,7 @@ class App.Controller extends Spine.Controller
|
||||||
container: 'body'
|
container: 'body'
|
||||||
html: true
|
html: true
|
||||||
delay: { show: 500, hide: 5200 }
|
delay: { show: 500, hide: 5200 }
|
||||||
placement: data.position
|
placement: "auto #{data.position}"
|
||||||
title: ->
|
title: ->
|
||||||
$(@).find('[title="*"]').val()
|
$(@).find('[title="*"]').val()
|
||||||
|
|
||||||
|
|
|
@ -89,11 +89,6 @@ class App.Navigation extends App.Controller
|
||||||
renderResult: (result = []) =>
|
renderResult: (result = []) =>
|
||||||
el = @$('#global-search-result')
|
el = @$('#global-search-result')
|
||||||
|
|
||||||
# destroy existing popovers
|
|
||||||
@ticketPopupsDestroy()
|
|
||||||
@userPopupsDestroy()
|
|
||||||
@organizationPopupsDestroy()
|
|
||||||
|
|
||||||
# remove result if not result exists
|
# remove result if not result exists
|
||||||
if _.isEmpty( result )
|
if _.isEmpty( result )
|
||||||
@$('.search').removeClass('open')
|
@$('.search').removeClass('open')
|
||||||
|
|
|
@ -227,10 +227,14 @@ class _taskManagerSingleton extends App.Controller
|
||||||
controller = @workers[ key ]
|
controller = @workers[ key ]
|
||||||
if controller
|
if controller
|
||||||
if key is thisKey
|
if key is thisKey
|
||||||
|
|
||||||
|
# execute controllers show
|
||||||
if controller.show
|
if controller.show
|
||||||
controller.show(params_app)
|
controller.show(params_app)
|
||||||
App.Event.trigger('ui:rerender:task')
|
App.Event.trigger('ui:rerender:task')
|
||||||
else
|
else
|
||||||
|
|
||||||
|
# execute controllers hide
|
||||||
if controller.hide
|
if controller.hide
|
||||||
controller.hide()
|
controller.hide()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue