ENHANCEMENT Allow adding new pages under specific nodes via tree context menu

This commit is contained in:
Ingo Schommer 2012-03-12 11:40:43 +01:00
parent 6768628606
commit 454a6e891d
3 changed files with 31 additions and 2 deletions

View File

@ -63,7 +63,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
CMS_DIR . '/javascript/CMSMain.EditForm.js',
CMS_DIR . '/javascript/CMSMain.AddForm.js',
CMS_DIR . '/javascript/CMSPageHistoryController.js',
// CMS_DIR . '/javascript/CMSPagesController.Tree.js',
CMS_DIR . '/javascript/CMSMain.Tree.js',
CMS_DIR . '/javascript/SilverStripeNavigator.js'
),
Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true)

View 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));

View File

@ -36,6 +36,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
'CMSMAIN.AddSearchCriteria': 'Add Criteria',
'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?',
'Folder.Name': 'Foldername'
'Folder.Name': 'Foldername',
'Tree.AddSubPage': 'Add new page here'
});
}