Created
May 22, 2009 11:55
-
-
Save LouisStAmour/116077 to your computer and use it in GitHub Desktop.
Enable Drag & Drop reordering by default in SilverStripe (2.3.2 or higher)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# For the truly lazy (like myself) -- By Louis St-Amour | |
# | |
# A quick script to enable drag & drop reordering by default. | |
# | |
# To install: | |
# 1. Name this file MyCMSDecorator.php in mysite/code | |
# 2. Requires DataObject::add_extension('LeftAndMain', 'MyCMSDecorator'); | |
# in mysite/_config.php | |
class MyCMSDecorator extends LeftAndMainDecorator { | |
function init() { | |
Requirements::javascript('jsparty/prototype.js'); | |
Requirements::customScript( | |
'DragByDefaultAction = Class.create(); | |
DragByDefaultAction.applyTo(\'#sortitems\'); | |
DragByDefaultAction.prototype = { | |
initialize: function () { | |
this.checked=true; | |
$(\'sitetree\').makeDraggable(); | |
} | |
}' | |
); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment