BUGFIX When adding a new widget by clicking one of the available widgets, add it to the top of the currently used widgets instead of the bottom

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@97522 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-01-26 00:23:51 +00:00 committed by Sam Minnee
parent c9bf87fd1a
commit d02f174f42
2 changed files with 2 additions and 2 deletions

View File

@ -169,14 +169,13 @@ WidgetAreaEditorClass.prototype = {
widget = document.createElement('div');
widget.innerHTML = response.responseText.replace(/Widget\[0\]/gi, "Widget[new-" + (++$('usedWidgets-'+this.name).parentNode.parentNode.maxid) + "]");
$('usedWidgets-'+this.name).appendChild(widget.childNodes[0]);
$('usedWidgetsStart-'+this.name).appendChild(widget.childNodes[0]);
$('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-'+this.name, {
tag: 'div',
handle: 'handle',

View File

@ -20,6 +20,7 @@
<p><% _t('TOADD', 'To add widgets, click one on the left to add it here') %></p>
<div class="usedWidgets" id="usedWidgets-$Name">
<div id="usedWidgetsStart-$Name"><!-- --></div>
<% if UsedWidgets %>
<% control UsedWidgets %>
$EditableSegment