BUGFIX Fixed loading indicator in for add form in ModelAdmin.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@63297 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-09-29 19:02:44 +00:00
parent b464952522
commit bb3adae0bc

View File

@ -195,7 +195,15 @@ $(document).ready(function() {
$('#Form_ManagedModelsSelect').submit(function(){
className = $('select option:selected', this).val();
requestPath = $(this).attr('action').replace('ManagedModelsSelect', className + '/add');
$('#ModelAdminPanel').fn('loadForm', requestPath);
var $button = $(':submit', this);
$('#ModelAdminPanel').fn(
'loadForm',
requestPath,
function() {
$button.removeClass('loading');
$button = null;
}
);
$('#form_actions_right').remove();
return false;
});
@ -218,8 +226,9 @@ $(document).ready(function() {
* Load a detail editing form into the main edit panel
* @todo Convert everything to jQuery so that the built-in load method can be used with this instead
*/
loadForm: function(url) {
loadForm: function(url, successCallback) {
$('#right #ModelAdminPanel').load(url, standardStatusHandler(function(result) {
if(typeof(successCallback) == 'function') successCallback.apply();
Behaviour.apply(); // refreshes ComplexTableField
}));
}