BUG Reload full view in admin/settings to avoid tabs breaking

Had the pjax "CurrentForm" marker set to the <form> tag,
which makes sense, but excludes the tabs. On refresh,
the tabset wasn't reinitialized, showing all form elements on
one page. Its easier to simply refresh the whole content area.
This commit is contained in:
Ingo Schommer 2012-07-13 11:00:21 +02:00
parent 54fd54a2fb
commit b74178e7fd
2 changed files with 12 additions and 4 deletions

View File

@ -6,6 +6,15 @@ class CMSSettingsController extends LeftAndMain {
static $menu_priority = -1; static $menu_priority = -1;
static $menu_title = 'Settings'; static $menu_title = 'Settings';
public function getResponseNegotiator() {
$neg = parent::getResponseNegotiator();
$controller = $this;
$neg->setCallback('CurrentForm', function() use(&$controller) {
return $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
});
return $neg;
}
/** /**
* @return Form * @return Form
*/ */
@ -16,8 +25,8 @@ class CMSSettingsController extends LeftAndMain {
$actions = $siteConfig->getCMSActions(); $actions = $siteConfig->getCMSActions();
$form = new Form($this, 'EditForm', $fields, $actions); $form = new Form($this, 'EditForm', $fields, $actions);
$form->addExtraClass('root-form'); $form->addExtraClass('root-form');
$form->addExtraClass('cms-edit-form cms-panel-padded center'); $form->addExtraClass('cms-edit-form cms-panel-padded center');
// don't add data-pjax-fragment=CurrentForm, its added in the content template instead
if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$form->setHTMLID('Form_EditForm'); $form->setHTMLID('Form_EditForm');
@ -47,8 +56,7 @@ class CMSSettingsController extends LeftAndMain {
$siteConfig->write(); $siteConfig->write();
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'Saved.'))); $this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'Saved.')));
return $this->getResponseNegotiator()->respond($this->request);
return $form->forTemplate();
} }
function LinkPreview() { function LinkPreview() {

View File

@ -1,4 +1,4 @@
<div class="cms-content center cms-tabset $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content"> <div class="cms-content center cms-tabset $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content CurrentForm">
<div class="cms-content-header north"> <div class="cms-content-header north">
<% with EditForm %> <% with EditForm %>