From 649ff87aeceef769133532fe39a52e0e7c03c4be Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 9 Aug 2008 06:18:32 +0000 Subject: [PATCH] (merged from branches/roa. use "svn log -c -g " for detailed commit message) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@60228 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/ModelAdmin.php | 17 ----------------- javascript/ModelAdmin.js | 18 +++++++++--------- templates/Includes/ModelAdmin_right.ss | 5 ++++- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index ace1115e..bbb8c8e1 100644 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -376,23 +376,6 @@ class ModelAdmin_CollectionController extends Controller { } return $output; } - - /** - * Action to render results for an autocomplete filter. - * - * @param unknown_type $request - * @return unknown - */ - function filter($request) { - $model = singleton($this->modelClass); - $context = $model->getDefaultSearchContext(); - $value = $request->getVar('q'); - $results = $context->getResults(array("Name"=>$value)); - header("Content-Type: text/plain"); - foreach($results as $result) { - echo $result->Name . "\n"; - } - } ///////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/javascript/ModelAdmin.js b/javascript/ModelAdmin.js index 7197d48d..adf2e040 100644 --- a/javascript/ModelAdmin.js +++ b/javascript/ModelAdmin.js @@ -19,27 +19,27 @@ jQuery(document).ready(function() { */ function showRecord(uri) { jQuery.get(uri, function(result){ - jQuery('#right').html(result); + jQuery('#right #ModelAdminPanel').html(result); jQuery('#SearchForm_holder').tabs(); // TODO/SAM: It seems a bit of a hack to have to list all the little updaters here. // Is livequery a solution? Behaviour.apply(); // refreshes ComplexTableField jQuery('#right ul.tabstrip').tabs(); - - jQuery('#Form_EditForm_action_goBack').click(function() { - if(__lastSearch) __lastSearch.trigger('submit'); - return false; - }); }); } + + jQuery('#Form_EditForm_action_goBack').livequery('click', function() { + if(__lastSearch) __lastSearch.trigger('submit'); + return false; + }); /** * POST a hash of form submitted data to the given endpoint */ function saveRecord(uri, data) { jQuery.post(uri, data, function(result){ - jQuery('#right').html(result); + jQuery('#right #ModelAdminPanel').html(result); // TODO/SAM: It seems a bit of a hack to have to list all the little updaters here. // Is livequery a solution? @@ -98,8 +98,8 @@ jQuery(document).ready(function() { form = jQuery(this); data = formData(form); jQuery.get(form.attr('action'), data, function(result){ - jQuery('#right').html(result); - jQuery('#right td').click(function(){ + jQuery('#right #ModelAdminPanel').html(result); + jQuery('#right #ModelAdminPanel td').click(function(){ td = jQuery(this); showRecord(td.parent().attr('title')); td.parent().parent().find('td').removeClass('active'); diff --git a/templates/Includes/ModelAdmin_right.ss b/templates/Includes/ModelAdmin_right.ss index 32e72de3..a1082f4d 100755 --- a/templates/Includes/ModelAdmin_right.ss +++ b/templates/Includes/ModelAdmin_right.ss @@ -1,4 +1,5 @@ -<% include Editor_toolbar %> + +
<% if EditForm %> $EditForm @@ -11,4 +12,6 @@ <% end_if %> +
+