ENHANCEMENT Declaring Pjax fragments on CMS templates and forms

This commit is contained in:
Ingo Schommer 2012-05-30 15:05:17 +02:00
parent 9c697f4f52
commit c9fc7cda65
8 changed files with 11 additions and 8 deletions

View File

@ -162,7 +162,7 @@ JS
$uploadBtn = new LiteralField(
'UploadButton',
sprintf(
'<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-target-panel=".cms-content" data-icon="drive-upload" href="%s">%s</a>',
'<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-pjax-target="Content" data-icon="drive-upload" href="%s">%s</a>',
Controller::join_links(singleton('CMSFileAddController')->Link(), '?ID=' . $folder->ID),
_t('Folder.UploadFilesButton', 'Upload')
)
@ -275,6 +275,7 @@ JS
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
// TODO Can't merge $FormAttributes in template at the moment
$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$this->extend('updateEditForm', $form);

View File

@ -625,6 +625,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
// TODO Can't merge $FormAttributes in template at the moment
$form->addExtraClass('center ss-tabset ' . $this->BaseCSSClasses());
// if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
if(!$record->canEdit() || $deletedFromStage) {
$readonlyFields = $form->Fields()->makeReadonly();
@ -720,7 +721,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$num = $item->numChildren();
if($num) {
return sprintf(
'<a class="cms-panel-link list-children-link" data-pjax="ListViewForm" data-target-panel="#Form_ListViewForm" href="%s?ParentID=%d&view=list">%s</a>',
'<a class="cms-panel-link list-children-link" data-pjax-target="ListViewForm,Breadcrumbs" href="%s?ParentID=%d&view=list">%s</a>',
$controller->Link(),
$item->ID,
$num
@ -737,6 +738,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
new FieldList($gridField),
new FieldList()
);
$listview->setAttribute('data-pjax-fragment', 'ListViewForm');
$this->extend('updateListView', $listview);

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<div id="pages-controller-cms-content" class="cms-content center cms-tabset $BaseCSSClasses" data-layout-type="border">
<div id="pages-controller-cms-content" class="cms-content center cms-tabset $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">
<div class="cms-content-header north">
<div>

View File

@ -1,4 +1,4 @@
<div id="pages-controller-cms-content" class="cms-content center cms-tabset $BaseCSSClasses" data-layout-type="border">
<div id="pages-controller-cms-content" class="cms-content center cms-tabset $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">
<div class="cms-content-header north">
<div>

View File

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

View File

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