From 6dc217c0a031e8eedd62ee003a8ad111de6e6e45 Mon Sep 17 00:00:00 2001 From: colymba Date: Mon, 13 Aug 2012 18:07:30 +0300 Subject: [PATCH] FIX: cachebuster var was not unique regenerate cachebuster var for each form its request --- javascript/GridFieldBulkImageUpload.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/javascript/GridFieldBulkImageUpload.js b/javascript/GridFieldBulkImageUpload.js index 032e05f..388f6d5 100644 --- a/javascript/GridFieldBulkImageUpload.js +++ b/javascript/GridFieldBulkImageUpload.js @@ -72,23 +72,25 @@ }, onunmatch: function(){ }, - onclick: function(e){ + onclick: function(e){ + var formsWithUpadtes, url, data, cacheBuster; - var formsWithUpadtes = $('form.bulkImageUploadUpdateForm.hasUpdate'); + formsWithUpadtes = $('form.bulkImageUploadUpdateForm.hasUpdate'); $(this).data('formsToUpdate', $(formsWithUpadtes).length); - var url = $(this).data('url'); - var cacheBuster = new Date().getTime(); + url = $(this).data('url'); if ( $(formsWithUpadtes).length > 0 ) $(this).addClass('loading'); + //@TODO execute 'doFinish' even when no form have been changed $(formsWithUpadtes).each(function(){ - var data = $(this).serialize(); + cacheBuster = new Date().getTime() + '_' + $(this).attr('name'); + data = $(this).serialize(); $.ajax({ url: url + '?cacheBuster=' + cacheBuster, data: data, type: "POST", context: $(this) - }).done(function() { + }).done(function() { var btn = $('#bulkImageUploadUpdateBtn'); var totalForms = parseInt( $(btn).data('formsToUpdate') );