mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR added stubs to allow widgets to use treedropdown fields (from r91850)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92471 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d6eaea02b1
commit
c14e7df9e8
@ -5,6 +5,10 @@
|
||||
* @subpackage content
|
||||
*/
|
||||
class WidgetAreaEditor extends FormField {
|
||||
function __construct($name) {
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
function FieldHolder() {
|
||||
Requirements::css(CMS_DIR . '/css/WidgetAreaEditor.css');
|
||||
Requirements::javascript(CMS_DIR . '/javascript/WidgetAreaEditor.js');
|
||||
@ -26,7 +30,7 @@ class WidgetAreaEditor extends FormField {
|
||||
|
||||
function UsedWidgets() {
|
||||
$relationName = $this->name;
|
||||
$widgets = $this->form->getRecord()->getComponent($relationName)->Widgets();
|
||||
$widgets = $this->form->getRecord()->getComponent($relationName)->Items();
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
@ -48,7 +52,7 @@ class WidgetAreaEditor extends FormField {
|
||||
|
||||
$record->$idName = $widgetarea->ID;
|
||||
|
||||
$widgets = $widgetarea->Widgets();
|
||||
$widgets = $widgetarea->Items();
|
||||
|
||||
// store the field IDs and delete the missing fields
|
||||
// alternatively, we could delete all the fields and re add them
|
||||
|
@ -160,6 +160,10 @@ WidgetAreaEditorClass.prototype = {
|
||||
$('usedWidgets-'+this.name).parentNode.parentNode.rewriteWidgetAreaAttributes();
|
||||
UsedWidget.applyToChildren($('usedWidgets-'+this.name), 'div.Widget');
|
||||
|
||||
// Repply some common form controls
|
||||
WidgetTreeDropdownField.applyTo('div.usedWidgets .TreeDropdownField');
|
||||
|
||||
|
||||
Sortable.create('usedWidgets-SideBar', {
|
||||
tag: 'div',
|
||||
handle: 'handle',
|
||||
@ -231,6 +235,15 @@ UsedWidget.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
WidgetTreeDropdownField = Class.extend('TreeDropdownField');
|
||||
WidgetTreeDropdownField.prototype = {
|
||||
getName: function() {
|
||||
return 'Widget_TDF_Endpoint';
|
||||
}
|
||||
}
|
||||
|
||||
WidgetTreeDropdownField.applyTo('div.usedWidgets .TreeDropdownField');
|
||||
|
||||
// Loop over all WidgetAreas and fire 'em up
|
||||
var wAs = $$('.WidgetAreaEditor');
|
||||
for(var i = 0; i < wAs.length; i++) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div class="usedWidgetsHolder">
|
||||
<h2><% _t('INUSE', 'Widgets currently used') %></h2>
|
||||
<p><% _t('TOADD', 'To add widgets, drag them from the left area to here.') %></p>
|
||||
<p><% _t('TOADD', 'To add widgets, click on the purple header on the left') %></p>
|
||||
|
||||
<div class="usedWidgets" id="usedWidgets-$Name">
|
||||
<% if UsedWidgets %>
|
||||
|
Loading…
Reference in New Issue
Block a user