Merge pull request #4740 from chillu/pulls/3.2/batch-action-url-fix

Batch actions break with Translatable installed
This commit is contained in:
Damian Mooyman 2015-11-04 09:31:21 +13:00
commit 44728d1c76

View File

@ -240,7 +240,7 @@
ids = this.getIDs(), ids = this.getIDs(),
allIds = [], allIds = [],
viewMode = $('.cms-content-batchactions :input[name=view-mode-batchactions]'), viewMode = $('.cms-content-batchactions :input[name=view-mode-batchactions]'),
selectedAction = this.find(':input[name=Action]').val(); actionUrl = this.find(':input[name=Action]').val();
// Default to refreshing the entire tree // Default to refreshing the entire tree
if(rootNode == null) rootNode = st; if(rootNode == null) rootNode = st;
@ -250,7 +250,7 @@
} }
// If no action is selected, enable all nodes // If no action is selected, enable all nodes
if(!selectedAction || selectedAction == -1 || !viewMode.is(":checked")) { if(!actionUrl || actionUrl == -1 || !viewMode.is(":checked")) {
$(rootNode).find('li').each(function() { $(rootNode).find('li').each(function() {
$(this).setEnabled(true); $(this).setEnabled(true);
}); });
@ -264,8 +264,12 @@
}); });
// Post to the server to ask which pages can have this batch action applied // Post to the server to ask which pages can have this batch action applied
var applicablePagesURL = selectedAction + '/applicablepages/?csvIDs=' + allIds.join(','); // Retain existing query parameters in URL before appending path
jQuery.getJSON(applicablePagesURL, function(applicableIDs) { var actionUrlParts = $.path.parseUrl(actionUrl);
var applicablePagesUrl = actionUrlParts.hrefNoSearch + '/applicablepages/';
applicablePagesUrl = $.path.addSearchParams(applicablePagesUrl, actionUrlParts.search);
applicablePagesUrl = $.path.addSearchParams(applicablePagesUrl, {csvIDs: allIds.join(',')});
jQuery.getJSON(applicablePagesUrl, function(applicableIDs) {
// Set a CSS class on each tree node indicating which can be batch-actioned and which can't // Set a CSS class on each tree node indicating which can be batch-actioned and which can't
jQuery(rootNode).find('li').each(function() { jQuery(rootNode).find('li').each(function() {
$(this).removeClass('treeloading'); $(this).removeClass('treeloading');