mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
elofgren: When 'Duplicate this page' is clicked, first silently (without confirmation) save the page, then duplicate it so the new page is identical to the other page. Closes gsoc Ticket #41: Apply xmedeko's "autoSave before page duplicate" fixes to gsoc branch. Adapted from code posted here: http://www.silverstripe.com/contributions/flat/2073 Thanks Ondra\!
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41963 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
4bd9352924
commit
c3dc22e7b8
@ -244,13 +244,8 @@ TreeContextMenu = {
|
|||||||
treeNode.selectTreeNode();
|
treeNode.selectTreeNode();
|
||||||
},
|
},
|
||||||
'Duplicate this page' : function(treeNode) {
|
'Duplicate this page' : function(treeNode) {
|
||||||
new Ajax.Request(baseHref() + 'admin/duplicate/' + treeNode.getIdx() + '?ajax=1', {
|
// First save the page silently (without confirmation) and then duplicate the page.
|
||||||
method : 'get',
|
autoSave(false, treeNode.duplicatePage.bind(treeNode));
|
||||||
onSuccess : Ajax.Evaluator,
|
|
||||||
onFailure : function(response) {
|
|
||||||
errorMessage('Error: ', response);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
'Sort sub-pages' : function(treeNode) {
|
'Sort sub-pages' : function(treeNode) {
|
||||||
var children = treeNode.treeNodeHolder().childTreeNodes();
|
var children = treeNode.treeNodeHolder().childTreeNodes();
|
||||||
|
@ -188,6 +188,15 @@ TreeNodeAPI.prototype = {
|
|||||||
Event.stop(event);
|
Event.stop(event);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
duplicatePage: function() {
|
||||||
|
new Ajax.Request(baseHref() + 'admin/duplicate/' + this.getIdx() + '?ajax=1', {
|
||||||
|
method : 'get',
|
||||||
|
onSuccess : Ajax.Evaluator,
|
||||||
|
onFailure : function(response) {
|
||||||
|
errorMessage('Error: ', response);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user