From 1741cf99cb7ec5a85eedaee154efb54af17fbffe Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 15 Sep 2007 01:11:25 +0000 Subject: [PATCH] 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 --- code/NewsletterAdmin.php | 9 +++++++-- javascript/NewsletterAdmin_right.js | 15 +-------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/code/NewsletterAdmin.php b/code/NewsletterAdmin.php index d1c3d8b6..611e41aa 100755 --- a/code/NewsletterAdmin.php +++ b/code/NewsletterAdmin.php @@ -457,7 +457,7 @@ class NewsletterAdmin extends LeftAndMain { FormResponse::set_node_title("mailtype_$id", $record->Title); FormResponse::status_message('Saved', 'good'); - + $result = $this->getActionUpdateJS($record); return FormResponse::respond(); } @@ -479,7 +479,12 @@ class NewsletterAdmin extends LeftAndMain { FormResponse::set_node_title($id, $record->Title); 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(); } diff --git a/javascript/NewsletterAdmin_right.js b/javascript/NewsletterAdmin_right.js index b6ef9bb9..b0e19df0 100755 --- a/javascript/NewsletterAdmin_right.js +++ b/javascript/NewsletterAdmin_right.js @@ -27,7 +27,7 @@ Behaviour.register({ * Processing called whenever a page is loaded in the right - including the initial one */ 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. * If confirmation is true it will ask for confirmation.