/**
* File: LeftAndMain.AddForm.js
*/
(function($) {
$.entwine('ss', function($){
/**
* Class: .add-form
*
* Simple form with a page type dropdown
* which creates a new page through .cms-edit-form and adds a new tree node.
*
* Requires:
* ss.i18n
* .cms-edit-form
*/
$('.add-form').entwine({
/**
* Variable: Tree
* (DOMElement)
*/
Tree: null,
/**
* Variable: OrigOptions
* (Array) Map of '));
}
} else {
// No tree node selected, reset to original elements
$.each(origOptions, function(i, optProps) {
if(optProps) dropdown.append($(''));
});
}
// TODO Re-select the currently selected element
// Disable dropdown if no elements are selectable
if(allowed) dropdown.removeAttr('disabled');
else dropdown.attr('disabled', 'disabled');
// Set default child (optional)
if(selectedNode.hints && selectedNode.hints.defaultChild) {
dropdown.val(selectedNode.hints.defaultChild);
}
// Set parent node (fallback to root)
this.find(':input[name=ParentID]').val(selectedNode ? selectedNode.data('id') : 0);
}
});
});
}(jQuery));