Permalink
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...
1 parent 5ac94c6 commit a56f9775d30378cbb80622fcdbd34b1ca4638662 @halkyon halkyon committed Dec 16, 2009
Showing with 4 additions and 12 deletions.
  1. +4 −12 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');

0 comments on commit a56f977

Please sign in to comment.