Improved AJAX calls.

This commit is contained in:
Martin Edenhofer 2012-07-15 16:41:47 +02:00
parent c76cb060a5
commit 99d1bfce00
13 changed files with 31 additions and 45 deletions

View file

@ -604,8 +604,7 @@ class App.Controller extends Spine.Controller
# get data # get data
@tickets = {} @tickets = {}
ajax = new App.Ajax App.Com.ajax(
ajax.ajax(
type: 'GET', type: 'GET',
url: '/ticket_customer', url: '/ticket_customer',
data: { data: {

View file

@ -18,10 +18,8 @@ class App.DashboardActivityStream extends App.Controller
@render( window.LastRefresh[ 'dashboard_activity_stream' ] ) @render( window.LastRefresh[ 'dashboard_activity_stream' ] )
# get data # get data
if @req App.Com.ajax(
@req.abort() id: 'dashoard_activity_stream',
@ajax = new App.Ajax
@req = @ajax.ajax(
type: 'GET', type: 'GET',
url: '/activity_stream', url: '/activity_stream',
data: { data: {

View file

@ -11,10 +11,8 @@ class App.DashboardRecentViewed extends App.Controller
@items = [] @items = []
# get data # get data
if @req App.Com.ajax(
@req.abort() id: 'dashboard_recent_viewed',
@ajax = new App.Ajax
@req = @ajax.ajax(
type: 'GET', type: 'GET',
url: '/recent_viewed', url: '/recent_viewed',
data: { data: {

View file

@ -15,10 +15,8 @@ class App.DashboardRss extends App.Controller
@render( window.LastRefresh[ 'dashboard_rss' ] ) @render( window.LastRefresh[ 'dashboard_rss' ] )
# get data # get data
if @req App.Com.ajax(
@req.abort() id: 'dashboard_rss',
@ajax = new App.Ajax
@req = @ajax.ajax(
type: 'GET', type: 'GET',
url: '/rss_fetch', url: '/rss_fetch',
data: { data: {

View file

@ -26,10 +26,8 @@ class App.DashboardTicket extends App.Controller
@render( window.LastRefresh[ @key ] ) @render( window.LastRefresh[ @key ] )
# get data # get data
if @req App.Com.ajax(
@req.abort() id: 'dashboard_ticket_' + @key,
@ajax = new App.Ajax
@req = @ajax.ajax(
type: 'GET', type: 'GET',
url: '/ticket_overviews', url: '/ticket_overviews',
data: { data: {

View file

@ -27,10 +27,8 @@ class Index extends App.Controller
# get data / in case also ticket data for split # get data / in case also ticket data for split
fetch: (params) -> fetch: (params) ->
if @req App.Com.ajax(
@req.abort() id: 'ticket_create',
@ajax = new App.Ajax
@req = @ajax.ajax(
type: 'GET', type: 'GET',
url: '/ticket_create', url: '/ticket_create',
data: { data: {

View file

@ -5,8 +5,8 @@ class App.TicketHistory extends App.ControllerModal
fetch: (@ticket_id) -> fetch: (@ticket_id) ->
# get data # get data
@ajax = new App.Ajax App.Com.ajax(
@ajax.ajax( id: 'ticket_history',
type: 'GET', type: 'GET',
url: '/ticket_history/' + ticket_id, url: '/ticket_history/' + ticket_id,
success: (data, status, xhr) => success: (data, status, xhr) =>

View file

@ -16,8 +16,8 @@ class App.TicketMerge extends App.ControllerModal
params = @formParam(e.target) params = @formParam(e.target)
# merge tickets # merge tickets
@ajax = new App.Ajax App.Com.ajax(
@ajax.ajax( id: 'ticket_merge',
type: 'GET', type: 'GET',
url: '/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'], url: '/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'],
data: { data: {

View file

@ -45,10 +45,8 @@ class Index extends App.Controller
@render() @render()
# get data # get data
if @req App.Com.ajax(
@req.abort() id: 'ticket_overview',
@ajax = new App.Ajax
@req = @ajax.ajax(
type: 'GET', type: 'GET',
url: '/ticket_overviews', url: '/ticket_overviews',
data: { data: {

View file

@ -30,8 +30,8 @@ class Index extends App.Controller
fetch: (ticket_id) -> fetch: (ticket_id) ->
# get data # get data
@ajax = new App.Ajax App.Com.ajax(
@ajax.ajax( id: 'ticket_zoom',
type: 'GET', type: 'GET',
url: '/ticket_full/' + ticket_id, url: '/ticket_full/' + ticket_id,
data: { data: {

View file

@ -22,8 +22,8 @@ class Index extends App.Controller
fetch: -> fetch: ->
# get data # get data
@ajax = new App.Ajax App.Com.ajax(
@ajax.ajax( id: 'getting_started',
type: 'GET', type: 'GET',
url: '/getting_started', url: '/getting_started',
data: { data: {

View file

@ -138,9 +138,8 @@ class App.Navigation extends App.Controller
# only of lod request is already done # only of lod request is already done
if !@req_overview if !@req_overview
@ajax = new App.Ajax @req_overview = App.Com.ajax(
# @req_overview.abort() id: 'navbar_ticket_overviews',
@req_overview = @ajax.ajax(
type: 'GET', type: 'GET',
url: '/ticket_overviews', url: '/ticket_overviews',
data: {}, data: {},
@ -184,8 +183,8 @@ class App.Navigation extends App.Controller
# only of lod request is already done # only of lod request is already done
if !@req_recent_viewed if !@req_recent_viewed
@ajax = new App.Ajax @req_recent_viewed = App.Com.ajax(
@req_recent_viewed = @ajax.ajax( id: 'navbar_recent_viewed',
type: 'GET', type: 'GET',
url: '/recent_viewed', url: '/recent_viewed',
data: { data: {

View file

@ -30,8 +30,8 @@ class Index extends App.Controller
params = @formParam(e.target) params = @formParam(e.target)
# get data # get data
ajax = new App.Ajax App.Com.ajax(
ajax.ajax( id: 'password_reset',
type: 'POST', type: 'POST',
url: '/users/password_reset', url: '/users/password_reset',
data: JSON.stringify(params), data: JSON.stringify(params),
@ -63,10 +63,10 @@ class Verify extends App.Controller
@navupdate '#reset_password_verify' @navupdate '#reset_password_verify'
# get data # get data
ajax = new App.Ajax
params = {} params = {}
params['token'] = @token params['token'] = @token
ajax.ajax( App.Com.ajax(
id: 'passwort_reset_verify',
type: 'POST', type: 'POST',
url: '/users/password_reset_verify', url: '/users/password_reset_verify',
data: JSON.stringify(params), data: JSON.stringify(params),
@ -96,8 +96,8 @@ class Verify extends App.Controller
params['token'] = @token params['token'] = @token
# get data # get data
ajax = new App.Ajax App.Com.ajax(
ajax.ajax( id: 'password_reset_verify',
type: 'POST', type: 'POST',
url: '/users/password_reset_verify', url: '/users/password_reset_verify',
data: JSON.stringify(params), data: JSON.stringify(params),