mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUGFIX Clicking available widgets now applies only to h3 elements
BUGFIX Widgets are now prepended to the available widget stack by use of Insertion.Top git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@97541 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
47f782c907
commit
334beaeedd
@ -15,8 +15,10 @@ WidgetAreaEditorClass.prototype = {
|
||||
// Gotta change their ID's because otherwise we get clashes between two tabs
|
||||
widget.id = widget.id + '-'+this.name;
|
||||
if(widget.id) {
|
||||
widget.onclick = function(event) {
|
||||
parts = event.currentTarget.id.split('-');
|
||||
// Clicking applies to the h3 element only, not the widget div itself
|
||||
var header = widget.childNodes[1];
|
||||
header.onclick = function(event) {
|
||||
parts = event.currentTarget.parentNode.id.split('-');
|
||||
var widgetArea = parts.pop();
|
||||
var className = parts.pop();
|
||||
$('WidgetAreaEditor-'+widgetArea).addWidget(className, widgetArea);
|
||||
@ -166,10 +168,9 @@ WidgetAreaEditorClass.prototype = {
|
||||
var usedWidgets = $('usedWidgets-'+this.name).childNodes;
|
||||
|
||||
// Give the widget a unique id
|
||||
widget = document.createElement('div');
|
||||
widget.innerHTML = response.responseText.replace(/Widget\[0\]/gi, "Widget[new-" + (++$('usedWidgets-'+this.name).parentNode.parentNode.maxid) + "]");
|
||||
|
||||
$('usedWidgetsStart-'+this.name).appendChild(widget.childNodes[0]);
|
||||
widgetContent = response.responseText.replace(/Widget\[0\]/gi, "Widget[new-" + (++$('usedWidgets-'+this.name).parentNode.parentNode.maxid) + "]");
|
||||
new Insertion.Top($('usedWidgets-'+this.name), widgetContent);
|
||||
|
||||
$('usedWidgets-'+this.name).parentNode.parentNode.rewriteWidgetAreaAttributes();
|
||||
UsedWidget.applyToChildren($('usedWidgets-'+this.name), 'div.Widget');
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
<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
|
||||
|
Loading…
Reference in New Issue
Block a user