From d02f174f420ad17010e3656cdd36f3a6e24d612f Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 26 Jan 2010 00:23:51 +0000 Subject: [PATCH] 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 --- javascript/WidgetAreaEditor.js | 3 +-- templates/WidgetAreaEditor.ss | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/WidgetAreaEditor.js b/javascript/WidgetAreaEditor.js index d8a61b71..448e2ea8 100644 --- a/javascript/WidgetAreaEditor.js +++ b/javascript/WidgetAreaEditor.js @@ -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', diff --git a/templates/WidgetAreaEditor.ss b/templates/WidgetAreaEditor.ss index d6983eb9..4a13f55a 100644 --- a/templates/WidgetAreaEditor.ss +++ b/templates/WidgetAreaEditor.ss @@ -20,6 +20,7 @@

<% _t('TOADD', 'To add widgets, click one on the left to add it here') %>

+
<% if UsedWidgets %> <% control UsedWidgets %> $EditableSegment