Improved meta attributes and task notification.

This commit is contained in:
Martin Edenhofer 2013-06-01 14:33:57 +02:00
parent ff62609d76
commit 25a500f5d1

View file

@ -38,8 +38,8 @@ class App.TicketZoom extends App.Controller
return if !@ticket return if !@ticket
meta = meta =
url: @url() url: @url()
head: @ticket.title + ' ' + @ticket.title head: @ticket.title
title: @ticket.number + ' ' + @ticket.title title: '#' + @ticket.number + ' - ' + @ticket.title
id: @ticket.id id: @ticket.id
url: => url: =>
@ -87,16 +87,23 @@ class App.TicketZoom extends App.Controller
processData: true processData: true
success: (data, status, xhr) => success: (data, status, xhr) =>
if @dataLastCall && !force if @dataLastCall && !force
return if _.isEqual( @dataLastCall.ticket, data.ticket)
# return if ticket hasnt changed
return if _.isEqual( @dataLastCall.ticket, data.ticket )
# return if ticket changed by my self
return if data.ticket.updated_by_id is @Session.all().id
# trigger task notify
diff = difference( @dataLastCall.ticket, data.ticket ) diff = difference( @dataLastCall.ticket, data.ticket )
console.log('diff', diff) console.log('diff', diff)
App.TaskManager.notify( @task_key ) App.TaskManager.notify( @task_key )
if $('[name="body"]').val() if $('[name="body"]').val()
App.Event.trigger 'notify', { # App.Event.trigger 'notify', {
type: 'success' # type: 'success'
msg: App.i18n.translateInline('Ticket has changed!') # msg: App.i18n.translateInline('Ticket has changed!')
timeout: 30000 # timeout: 30000
} # }
return return
@dataLastCall = data @dataLastCall = data