Browse files

MINOR Better failsafes for tree hints (allows move if hint for class …

…is if not defined)
  • Loading branch information...
1 parent 5a0eef5 commit 0caf1991cf4c4f63650053ce66385cdf101ee0d5 @chillu chillu committed Jan 9, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 admin/javascript/LeftAndMain.Tree.js
View
6 admin/javascript/LeftAndMain.Tree.js
@@ -63,9 +63,11 @@
newParentClass = newParent.getClassname(),
// Check allowedChildren of newParent or against root node rules
hints = self.getHints(),
- disallowedChildren = [];
+ disallowedChildren = [],
+ hintKey = newParentClass ? newParentClass : 'Root',
+ hint = (typeof hints[hintKey] != 'undefined') ? hints[hintKey] : null;
- if(hints) disallowedChildren = hints[newParentClass ? newParentClass : 'Root'].disallowedChildren || [];
+ if(hint) disallowedChildren = (typeof hint.disallowedChildren != 'undefined') ? hint.disallowedChildren : [];
var isAllowed = (
// Don't allow moving the root node
movedNode.data('id') != 0

0 comments on commit 0caf199

Please sign in to comment.