diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 65fbdb13..9ca284e0 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -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) diff --git a/javascript/CMSMain.Tree.js b/javascript/CMSMain.Tree.js new file mode 100644 index 00000000..b7a6d41a --- /dev/null +++ b/javascript/CMSMain.Tree.js @@ -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)); \ No newline at end of file diff --git a/javascript/lang/en_US.js b/javascript/lang/en_US.js index 1b98091f..9b8b89f9 100644 --- a/javascript/lang/en_US.js +++ b/javascript/lang/en_US.js @@ -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' }); }