mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-09-29 12:49:00 +02:00
ENHANCEMENT Allow adding new pages under specific nodes via tree context menu
This commit is contained in:
parent
6768628606
commit
454a6e891d
@ -63,7 +63,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
CMS_DIR . '/javascript/CMSMain.EditForm.js',
|
CMS_DIR . '/javascript/CMSMain.EditForm.js',
|
||||||
CMS_DIR . '/javascript/CMSMain.AddForm.js',
|
CMS_DIR . '/javascript/CMSMain.AddForm.js',
|
||||||
CMS_DIR . '/javascript/CMSPageHistoryController.js',
|
CMS_DIR . '/javascript/CMSPageHistoryController.js',
|
||||||
// CMS_DIR . '/javascript/CMSPagesController.Tree.js',
|
CMS_DIR . '/javascript/CMSMain.Tree.js',
|
||||||
CMS_DIR . '/javascript/SilverStripeNavigator.js'
|
CMS_DIR . '/javascript/SilverStripeNavigator.js'
|
||||||
),
|
),
|
||||||
Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true)
|
Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true)
|
||||||
|
28
javascript/CMSMain.Tree.js
Normal file
28
javascript/CMSMain.Tree.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
(function($) {
|
||||||
|
|
||||||
|
$.entwine('ss', function($){
|
||||||
|
|
||||||
|
$('.cms-tree').entwine({
|
||||||
|
getTreeConfig: function() {
|
||||||
|
var config = this._super();
|
||||||
|
config.plugins.push('contextmenu');
|
||||||
|
config.contextmenu = {
|
||||||
|
'items': {
|
||||||
|
'create': null,
|
||||||
|
"rename": null,
|
||||||
|
"remove": null,
|
||||||
|
"ccp": null,
|
||||||
|
'addsubpage': {
|
||||||
|
'label': ss.i18n._t('Tree.AddSubPage'),
|
||||||
|
'action': function(obj) {
|
||||||
|
// TODO Fix hardcoding of link
|
||||||
|
$('.cms-container').loadPanel('admin/page/add/?ParentID=' + obj.data('id'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}(jQuery));
|
@ -36,6 +36,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
|||||||
'CMSMAIN.AddSearchCriteria': 'Add Criteria',
|
'CMSMAIN.AddSearchCriteria': 'Add Criteria',
|
||||||
'WidgetAreaEditor.TOOMANY': 'Sorry, you have reached the maximum number of widgets in this area',
|
'WidgetAreaEditor.TOOMANY': 'Sorry, you have reached the maximum number of widgets in this area',
|
||||||
'AssetAdmin.ConfirmDelete': 'Do you really want to delete this folder and all contained files?',
|
'AssetAdmin.ConfirmDelete': 'Do you really want to delete this folder and all contained files?',
|
||||||
'Folder.Name': 'Foldername'
|
'Folder.Name': 'Foldername',
|
||||||
|
'Tree.AddSubPage': 'Add new page here'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user