FIX bulkaction finally take care of url variables properly

This commit is contained in:
colymba 2014-03-14 13:58:16 +02:00
parent cb69f71362
commit cc8aa9e951
2 changed files with 29 additions and 19 deletions

View File

@ -57,7 +57,7 @@
else cacheBuster = '?cacheBuster=' + cacheBuster; else cacheBuster = '?cacheBuster=' + cacheBuster;
$.ajax({ $.ajax({
url: url + '/' + cacheBuster, url: url + cacheBuster,
data: data, data: data,
type: "POST", type: "POST",
context: $(this) context: $(this)

View File

@ -95,7 +95,29 @@
onmatch: function(){ onmatch: function(){
}, },
onunmatch: function(){ onunmatch: function(){
}, },
getActionURL: function(action, url)
{
var cacheBuster = new Date().getTime();
url = url.split('?');
if ( action )
{
action = '/' + action;
}
else{
action = '';
}
if ( url[1] )
{
url = url[0] + action + '?' + url[1] + '&' + 'cacheBuster=' + cacheBuster;
}
else{
url = url[0] + action + '?' + 'cacheBuster=' + cacheBuster;
}
return url;
},
onclick: function(e) onclick: function(e)
{ {
var $parent = $(this).parents('.bulkManagerOptions'), var $parent = $(this).parents('.bulkManagerOptions'),
@ -104,12 +126,10 @@
action = $parent.find('select.bulkActionName').val(), action = $parent.find('select.bulkActionName').val(),
config = $btn.data('config'), config = $btn.data('config'),
url = $(this).data('url'), url = this.getActionURL(action, $(this).data('url')),
ids = $(this).parents('.bulkManagerOptions').find('input.bulkSelectAll:first').getSelectRecordsID(), ids = $(this).parents('.bulkManagerOptions').find('input.bulkSelectAll:first').getSelectRecordsID(),
data = { records: ids }, data = { records: ids }
cacheBuster = new Date().getTime()
; ;
@ -128,15 +148,12 @@
} }
} }
$btn.addClass('loading'); $btn.addClass('loading');
if ( config[action]['isAjax'] ) if ( config[action]['isAjax'] )
{ {
//if ( url.indexOf('?') !== -1 ) cacheBuster = '&cacheBuster=' + cacheBuster;
//else cacheBuster = '?cacheBuster=' + cacheBuster;
$.ajax({ $.ajax({
url: url + '/' + action + '?cacheBuster=' + cacheBuster, url: url,
data: data, data: data,
type: "POST", type: "POST",
context: $(this) context: $(this)
@ -147,14 +164,7 @@
} }
else{ else{
var records = 'records[]='+ids.join('&records[]='); var records = 'records[]='+ids.join('&records[]=');
url = url + '&' + records;
if ( window.location.search )
{
url = url + '/' + action + window.location.search + '&' + records + '&cacheBuster=' + cacheBuster;
}
else{
url = url + '/' + action + '?' + records + '&cacheBuster=' + cacheBuster;
}
window.location.href = url; window.location.href = url;
} }