From 0b7572abd542c8222a58dbdd7521e9ca12ec3c0d Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 16 Jun 2009 05:54:22 +0000 Subject: [PATCH] MINOR Removed javascript debug call in ModelAdmin.js ENHANCEMENT Calling tinymce callbacks for destroying previous instances and triggering saves in ModelAdmin.js. No full support for TinyMCE in ModelAdmin yet though. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@79352 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/ModelAdmin.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/javascript/ModelAdmin.js b/javascript/ModelAdmin.js index 659bfdba..80dedaa4 100644 --- a/javascript/ModelAdmin.js +++ b/javascript/ModelAdmin.js @@ -88,6 +88,9 @@ $(document).ready(function() { */ $('#SearchForm_holder .tab form:not(#Form_ImportForm)').submit(function () { var $form = $(this); + + // @todo TinyMCE coupling + tinymce_removeAll(); $('#ModelAdminPanel').fn('startHistory', $(this).attr('action'), $(this).formToArray()); $('#ModelAdminPanel').load($(this).attr('action'), $(this).formToArray(), standardStatusHandler(function(result) { @@ -100,7 +103,7 @@ $(document).ready(function() { $('#form_actions_right').remove(); Behaviour.apply(); - console.log(window.onresize); + if(window.onresize) window.onresize(); // Remove the loading indicators from the buttons $('input[type=submit]', $form).removeClass('loading'); @@ -195,8 +198,14 @@ $(document).ready(function() { var form = $('#right form'); var formAction = form.attr('action') + '?' + $(this).fieldSerialize(); + // @todo TinyMCE coupling + if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave(); + // Post the data to save $.post(formAction, form.formToArray(), function(result){ + // @todo TinyMCE coupling + tinymce_removeAll(); + $('#right #ModelAdminPanel').html(result); if($('#right #ModelAdminPanel form').hasClass('validationerror')) { @@ -285,6 +294,9 @@ $(document).ready(function() { * @todo Convert everything to jQuery so that the built-in load method can be used with this instead */ loadForm: function(url, successCallback) { + // @todo TinyMCE coupling + tinymce_removeAll(); + $('#right #ModelAdminPanel').load(url, standardStatusHandler(function(result) { if(typeof(successCallback) == 'function') successCallback.apply(); if(!this.future || !this.future.length) {