mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +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();
|
||||
},
|
||||
'Duplicate this page' : function(treeNode) {
|
||||
new Ajax.Request(baseHref() + 'admin/duplicate/' + treeNode.getIdx() + '?ajax=1', {
|
||||
method : 'get',
|
||||
onSuccess : Ajax.Evaluator,
|
||||
onFailure : function(response) {
|
||||
errorMessage('Error: ', response);
|
||||
}
|
||||
});
|
||||
// First save the page silently (without confirmation) and then duplicate the page.
|
||||
autoSave(false, treeNode.duplicatePage.bind(treeNode));
|
||||
},
|
||||
'Sort sub-pages' : function(treeNode) {
|
||||
var children = treeNode.treeNodeHolder().childTreeNodes();
|
||||
|
@ -188,6 +188,15 @@ TreeNodeAPI.prototype = {
|
||||
Event.stop(event);
|
||||
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