mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR Using Form->forTemplate() to include <form> tags in controller actions on AssetAdmin and CMSMain (underlying clientside logic has changed)
This commit is contained in:
parent
75ce441348
commit
c4c3d21fa9
@ -358,7 +358,7 @@ JS
|
||||
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 @@ JS;
|
||||
|
||||
$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 @@ JS;
|
||||
$form = $this->getEditForm($record->ID);
|
||||
}
|
||||
|
||||
return $form->formHtmlContent();
|
||||
return $form->forTemplate();
|
||||
}
|
||||
|
||||
|
||||
@ -615,7 +615,7 @@ JS;
|
||||
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 @@ JS;
|
||||
|
||||
$form = $this->getEditForm($record->ID);
|
||||
|
||||
return $form->formHtmlContent();
|
||||
return $form->forTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -791,7 +791,7 @@ JS;
|
||||
'Live',
|
||||
"\"SiteTree_Live\".\"ID\" = $recordID"
|
||||
);
|
||||
return ($liveRecord) ? $form->formHtmlContent() : "";
|
||||
return ($liveRecord) ? $form->forTemplate() : "";
|
||||
} else {
|
||||
$this->redirectBack();
|
||||
}
|
||||
@ -988,7 +988,7 @@ JS;
|
||||
|
||||
$form = $this->getEditForm($record->ID);
|
||||
|
||||
return $form->formHtmlContent();
|
||||
return $form->forTemplate();
|
||||
}
|
||||
|
||||
function publish($data, $form) {
|
||||
@ -1013,7 +1013,7 @@ JS;
|
||||
// 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 @@ JS;
|
||||
}
|
||||
|
||||
if($this->isAjax()) {
|
||||
return $form->formHtmlContent();
|
||||
return $form->forTemplate();
|
||||
} else {
|
||||
$templateData = $this->customise(array(
|
||||
"EditForm" => $form
|
||||
@ -1426,7 +1426,7 @@ JS;
|
||||
// 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 @@ JS;
|
||||
// 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 @@ JS;
|
||||
// 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 @@ class CMSPagesController extends CMSMain {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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() {
|
||||
|
@ -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');
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user