mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
BUGFIX Fixed case where "NoWidgets" was trying to be called on editablesegment
MINOR Code formatting on WidgetAreaEditor.js to make it easier to read git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@76176 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a9ea6549c3
commit
0edf8eb19b
@ -14,9 +14,19 @@ WidgetAreaEditor.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create dummy sortable to prevent javascript errors
|
// Create dummy sortable to prevent javascript errors
|
||||||
Sortable.create('WidgetAreaEditor_availableWidgets', {tag: 'li', handle: 'handle', containment: []});
|
Sortable.create('WidgetAreaEditor_availableWidgets', {
|
||||||
|
tag: 'li',
|
||||||
|
handle: 'handle',
|
||||||
|
containment: []
|
||||||
|
});
|
||||||
|
|
||||||
// Used widgets are sortable
|
// Used widgets are sortable
|
||||||
Sortable.create('WidgetAreaEditor_usedWidgets', {tag: 'div', handle: 'handle', containment: ['WidgetAreaEditor_availableWidgets', 'WidgetAreaEditor_usedWidgets'], onUpdate: this.updateWidgets});
|
Sortable.create('WidgetAreaEditor_usedWidgets', {
|
||||||
|
tag: 'div',
|
||||||
|
handle: 'handle',
|
||||||
|
containment: ['WidgetAreaEditor_availableWidgets', 'WidgetAreaEditor_usedWidgets'],
|
||||||
|
onUpdate: this.updateWidgets
|
||||||
|
});
|
||||||
|
|
||||||
// Figure out maxid, this is used when creating new widgets
|
// Figure out maxid, this is used when creating new widgets
|
||||||
this.maxid = 0;
|
this.maxid = 0;
|
||||||
@ -60,8 +70,10 @@ WidgetAreaEditor.prototype = {
|
|||||||
var usedWidgets = $('WidgetAreaEditor_usedWidgets').childNodes;
|
var usedWidgets = $('WidgetAreaEditor_usedWidgets').childNodes;
|
||||||
for(var i = 0; i < usedWidgets.length; i++) {
|
for(var i = 0; i < usedWidgets.length; i++) {
|
||||||
var widget = usedWidgets[i];
|
var widget = usedWidgets[i];
|
||||||
if(widget.id && (widget.id.indexOf("Widget[") != 0)) {
|
if(widget.id && (widget.id.indexOf("Widget[") != 0) && (widget.id != 'NoWidgets')) {
|
||||||
new Ajax.Request('Widget_Controller/EditableSegment/' + widget.id, {onSuccess : $('WidgetAreaEditor_usedWidgets').parentNode.parentNode.insertWidgetEditor.bind(this)});
|
new Ajax.Request('Widget_Controller/EditableSegment/' + widget.id, {
|
||||||
|
onSuccess : $('WidgetAreaEditor_usedWidgets').parentNode.parentNode.insertWidgetEditor.bind(this)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -92,7 +104,14 @@ WidgetAreaEditor.prototype = {
|
|||||||
|
|
||||||
// Reapply behaviour
|
// Reapply behaviour
|
||||||
new Draggable(clone.id);
|
new Draggable(clone.id);
|
||||||
Sortable.create('WidgetAreaEditor_usedWidgets', {tag: 'div', handle: 'handle', containment: ['WidgetAreaEditor_availableWidgets', 'WidgetAreaEditor_usedWidgets'], onUpdate: $('WidgetAreaEditor_usedWidgets').parentNode.parentNode.updateWidgets});
|
|
||||||
|
Sortable.create('WidgetAreaEditor_usedWidgets', {
|
||||||
|
tag: 'div',
|
||||||
|
handle: 'handle',
|
||||||
|
containment: ['WidgetAreaEditor_availableWidgets', 'WidgetAreaEditor_usedWidgets'],
|
||||||
|
onUpdate: $('WidgetAreaEditor_usedWidgets').parentNode.parentNode.updateWidgets
|
||||||
|
});
|
||||||
|
|
||||||
UsedWidget.applyToChildren($('WidgetAreaEditor_usedWidgets'), 'div.Widget');
|
UsedWidget.applyToChildren($('WidgetAreaEditor_usedWidgets'), 'div.Widget');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user