elofgren: Make Newsletter AJAX action buttons be update after submit like happens in all other sections of the Admin. Use 'form_actions_right' instead of 'form_actions' and remove unneeded duplicated 'Form_EditForm_action_save' Behaviour.register in NewsletterAdmin?_right.js

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41878 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-15 01:11:25 +00:00
parent 0c895b3a30
commit 1741cf99cb
2 changed files with 8 additions and 16 deletions

View File

@ -457,7 +457,7 @@ class NewsletterAdmin extends LeftAndMain {
FormResponse::set_node_title("mailtype_$id", $record->Title); FormResponse::set_node_title("mailtype_$id", $record->Title);
FormResponse::status_message('Saved', 'good'); FormResponse::status_message('Saved', 'good');
$result = $this->getActionUpdateJS($record);
return FormResponse::respond(); return FormResponse::respond();
} }
@ -479,7 +479,12 @@ class NewsletterAdmin extends LeftAndMain {
FormResponse::set_node_title($id, $record->Title); FormResponse::set_node_title($id, $record->Title);
FormResponse::status_message('Saved', 'good'); FormResponse::status_message('Saved', 'good');
// Get the new action buttons
$actionList = '';
foreach($form->Actions() as $action) {
$actionList .= $action->Field() . ' ';
}
FormResponse::add("$('Form_EditForm').loadActionsFromString('" . Convert::raw2js($actionList) . "');");
return FormResponse::respond(); return FormResponse::respond();
} }

View File

@ -27,7 +27,7 @@ Behaviour.register({
* Processing called whenever a page is loaded in the right - including the initial one * Processing called whenever a page is loaded in the right - including the initial one
*/ */
prepareForm : function() { prepareForm : function() {
ajaxActionsAtTop('Form_EditForm', 'form_actions', 'right'); ajaxActionsAtTop('Form_EditForm', 'form_actions_right', 'right');
}, },
/** /**
@ -392,19 +392,6 @@ NewsletterList.prototype = {
} }
} }
/**
* Add page action
* @todo Remove duplication between this and the CMSMain Add page action
*/
Behaviour.register( {
'#Form_EditForm_action_save': {
onclick : function() {
$('Form_EditForm').save();
return false;
}
}
});
/** /**
* Handle auto-saving. Detects if changes have been made, and if so save everything on the page. * Handle auto-saving. Detects if changes have been made, and if so save everything on the page.
* If confirmation is true it will ask for confirmation. * If confirmation is true it will ask for confirmation.