Permalink
Browse files

MINOR Using Form->forTemplate() to include <form> tags in controller …

…actions on AssetAdmin and CMSMain (underlying clientside logic has changed)
  • Loading branch information...
1 parent 75ce441 commit c4c3d21fa940b779306fa7da995d47a2a2100e58 @chillu chillu committed Jun 7, 2011
@@ -358,7 +358,7 @@ public function doAdd($data, $form) {
return $record->ID;
} else if($this->isAjax()) {
$form = $this->getEditForm($record->ID);
- return $form->formHtmlContent();
+ return $form->forTemplate();
} else {
return $this->redirect(Controller::join_links($this->Link('show'), $record->ID));
}
@@ -345,7 +345,7 @@ function save_siteconfig($data, $form) {
$this->response->addHeader('X-Status', _t('LeftAndMain.SAVEDUP'));
- return $form->formHtmlContent();
+ return $form->forTemplate();
}
/**
* Get a database record to be managed by the CMS
@@ -578,7 +578,7 @@ public function save($data, $form) {
$form = $this->getEditForm($record->ID);
}
- return $form->formHtmlContent();
+ return $form->forTemplate();
}
@@ -615,7 +615,7 @@ public function doAdd($data, $form) {
return $record->ID;
} else if(Director::is_ajax()) {
$form = $this->getEditForm($record->ID);
- return $form->formHtmlContent();
+ return $form->forTemplate();
} else {
return $this->redirect(Controller::join_links($this->Link('show'), $record->ID));
}
@@ -757,7 +757,7 @@ public function revert($data, $form) {
$form = $this->getEditForm($record->ID);
- return $form->formHtmlContent();
+ return $form->forTemplate();
}
/**
@@ -791,7 +791,7 @@ public function delete($data, $form) {
'Live',
"\"SiteTree_Live\".\"ID\" = $recordID"
);
- return ($liveRecord) ? $form->formHtmlContent() : "";
+ return ($liveRecord) ? $form->forTemplate() : "";
} else {
$this->redirectBack();
}
@@ -988,7 +988,7 @@ function rollback($data, $form) {
$form = $this->getEditForm($record->ID);
- return $form->formHtmlContent();
+ return $form->forTemplate();
}
function publish($data, $form) {
@@ -1013,7 +1013,7 @@ function unpublish($data, $form) {
// Reload form, data and actions might have changed
$form = $this->getEditForm($record->ID);
- return $form->formHtmlContent();
+ return $form->forTemplate();
}
function performRollback($id, $version) {
@@ -1187,7 +1187,7 @@ function compareversions() {
}
if($this->isAjax()) {
- return $form->formHtmlContent();
+ return $form->forTemplate();
} else {
$templateData = $this->customise(array(
"EditForm" => $form
@@ -1426,7 +1426,7 @@ function restore($data, $form) {
// Reload form, data and actions might have changed
$form = $this->getEditForm($restoredPage->ID);
- return $form->formHtmlContent();
+ return $form->forTemplate();
}
function duplicate($request) {
@@ -1450,7 +1450,7 @@ function duplicate($request) {
// Reload form, data and actions might have changed
$form = $this->getEditForm($newPage->ID);
- return $form->formHtmlContent();
+ return $form->forTemplate();
} else {
user_error("CMSMain::duplicate() Bad ID: '$id'", E_USER_WARNING);
}
@@ -1471,7 +1471,7 @@ function duplicatewithchildren($request) {
// Reload form, data and actions might have changed
$form = $this->getEditForm($newPage->ID);
- return $form->formHtmlContent();
+ return $form->forTemplate();
} else {
user_error("CMSMain::duplicate() Bad ID: '$id'", E_USER_WARNING);
}
@@ -13,8 +13,12 @@ function init() {
}
function show($request) {
- $c = new CMSPageEditController();
- return $this->redirect(Controller::join_links($c->Link('show'), $request->param('ID')));
+ if($request->param('ID')) {
+ $c = new CMSPageEditController();
+ return $this->redirect(Controller::join_links($c->Link('show'), $request->param('ID')));
+ } else {
+ return parent::show($request);
+ }
}
}
View
@@ -47,7 +47,7 @@
var currNode = $('.cms-tree')[0].firstSelected();
if(currNode) {
var url = $(currNode).find('a').attr('href');
- $('.cms-edit-form').loadForm(url);
+ $('.cms-content').loadForm(url);
}
$('.cms-tree')[0].setCustomURL('admin/assets/getsubtree');
$('.cms-tree')[0].reload({onSuccess: function() {
View
@@ -201,8 +201,9 @@
if (e.button!=2) {
var $link = $(this);
$link.addClass('loading');
- jQuery('.cms-edit-form').entwine('ss').loadForm(
+ jQuery('.cms-content').entwine('ss').loadForm(
$(this).attr('href'),
+ null,
function(e) {
$link.removeClass('loading');
}
@@ -263,8 +264,9 @@
var link = $(this).siblings('.versionlink').find('a').attr('href');
td.addClass('loading');
- jQuery('.cms-edit-form').entwine('ss').loadForm(
+ jQuery('.cms-content').entwine('ss').loadForm(
link,
+ null,
function(e) {
td.removeClass('loading');
}
@@ -314,8 +316,9 @@
data.push({name:$button.attr('name'), value: $button.val()});
if(loadEditForm) {
- jQuery('.cms-edit-form').entwine('ss').loadForm(
+ jQuery('.cms-content').entwine('ss').loadForm(
this.attr('action'),
+ null,
function(e) {
$button.removeClass('loading');
},

0 comments on commit c4c3d21

Please sign in to comment.