Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR fixed bug where widget area editor would not be activated (from…

… r94829)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@95652 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit a56f9775d30378cbb80622fcdbd34b1ca4638662 1 parent 5ac94c6
@halkyon halkyon authored
Showing with 4 additions and 12 deletions.
  1. +4 −12 javascript/WidgetAreaEditor.js
View
16 javascript/WidgetAreaEditor.js
@@ -5,8 +5,7 @@ WidgetAreaEditorClass.prototype = {
this.name = this.getAttribute('name');
this.rewriteWidgetAreaAttributes();
UsedWidget.applyToChildren($('usedWidgets-'+this.name), 'div.Widget');
-
- // Make available widgets draggable
+
var availableWidgets = $('availableWidgets-'+this.name).childNodes;
for(var i = 0; i < availableWidgets.length; i++) {
@@ -114,8 +113,8 @@ WidgetAreaEditorClass.prototype = {
if ($('WidgetAreaEditor-'+holder).getAttribute('maxwidgets')) {
var maxCount = $('WidgetAreaEditor-'+holder).getAttribute('maxwidgets');
var count = $$('#usedWidgets-'+holder+' .Widget').length;
- if (count > maxCount) {
- alert('Sorry, you have reached the maximum number of widgets in this area');
+ if (count+1 > maxCount) {
+ alert(ss.i18n._t('WidgetAreaEditor.TOOMANY'));
return;
}
}
@@ -255,11 +254,4 @@ WidgetTreeDropdownField.prototype = {
}
WidgetTreeDropdownField.applyTo('div.usedWidgets .TreeDropdownField');
-
-// Loop over all WidgetAreas and fire 'em up
-var wAs = $$('.WidgetAreaEditor');
-for(var i = 0; i < wAs.length; i++) {
- WidgetAreaEditorClass.applyTo('div#'+wAs[i].id);
-
-}
-
+WidgetAreaEditorClass.applyTo('.WidgetAreaEditor');
Please sign in to comment.
Something went wrong with that request. Please try again.