BUGFIX Fixed ParentType selector javascript in SiteTree->getCMSFields()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92676 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:39:18 +00:00
parent 21160c6ccb
commit 1bac2dc4aa
2 changed files with 20 additions and 25 deletions

View File

@ -68,6 +68,10 @@
padding: 0; padding: 0;
} }
.right form .parentTypeSelector {
margin-left: 0;
}
.right form .dropdown, .right form .dropdown,
.right form .countrydropdown { .right form .countrydropdown {
font-size: 12px; font-size: 12px;

View File

@ -139,34 +139,25 @@ var ss_MainLayout;
/** /**
* @class ParentID field combination - mostly toggling between * @class ParentID field combination - mostly toggling between
* the two radiobuttons and setting the hidden "ParentID" field * the two radiobuttons and setting the hidden "ParentID" field
* @name ss.EditForm.ParentType * @name ss.EditForm.parentTypeSelector
*/ */
$('#Form_EditForm_ParentType').concrete('ss', function($){ $('#Form_EditForm .parentTypeSelector').concrete('ss', function($){
return/** @lends ss.EditForm.ParentType */{ return/** @lends ss.EditForm.parentTypeSelector */{
onmatch : function() { onmatch : function() {
var parentTypeRootEl = $('#Form_EditForm_ParentType_root'); var self = this;
var parentTypeSubpageEl = $('#Form_EditForm_ParentType_subpage');
if(parentTypeRootEl) { this.find(':input[name=ParentType]').bind('click', function(e) {self._toggleSelection(e);});
parentTypeRootEl.onclick = this._rootClick.bind(this);
} this._toggleSelection();
if(parentTypeSubpageEl) {
parentTypeSubpageEl.onclick = this.showHide;
}
this.showHide();
}, },
_rootClick : function() { _toggleSelection: function(e) {
$('#Form_EditForm_ParentID').val(0); var selected = this.find(':input[name=ParentType]:checked').val();
this.showHide(); // reset parent id if 'root' radiobutton is selected
}, if(selected == 'root') this.find(':input[name=ParentID]').val(0);
console.debug(selected);
showHide : function() { // toggle tree dropdown based on selection
var parentTypeRootEl = $('#Form_EditForm_ParentType_root'); this.find('#ParentID').toggle(selected != 'root');
if(parentTypeRootEl && parentTypeRootEl.checked) {
$('#ParentID').hide();
} else {
$('#ParentID').show();
}
} }
}; };
}); });