Merge branch 'pjax-multiple'

This commit is contained in:
Ingo Schommer 2012-06-05 14:01:20 +02:00
commit ca9f4f6f6f
9 changed files with 20 additions and 10 deletions

View File

@ -169,7 +169,7 @@ JS
$uploadBtn = new LiteralField( $uploadBtn = new LiteralField(
'UploadButton', 'UploadButton',
sprintf( 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), Controller::join_links(singleton('CMSFileAddController')->Link(), '?ID=' . $folder->ID),
_t('Folder.UploadFilesButton', 'Upload') _t('Folder.UploadFilesButton', 'Upload')
) )
@ -282,6 +282,7 @@ JS
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
// TODO Can't merge $FormAttributes in template at the moment // TODO Can't merge $FormAttributes in template at the moment
$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses()); $form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$this->extend('updateEditForm', $form); $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 // TODO Can't merge $FormAttributes in template at the moment
$form->addExtraClass('center ss-tabset ' . $this->BaseCSSClasses()); $form->addExtraClass('center ss-tabset ' . $this->BaseCSSClasses());
// if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); // if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
if(!$record->canEdit() || $deletedFromStage) { if(!$record->canEdit() || $deletedFromStage) {
$readonlyFields = $form->Fields()->makeReadonly(); $readonlyFields = $form->Fields()->makeReadonly();
@ -720,7 +721,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$num = $item->numChildren(); $num = $item->numChildren();
if($num) { if($num) {
return sprintf( 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(), $controller->Link(),
$item->ID, $item->ID,
$num $num
@ -737,6 +738,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
new FieldList($gridField), new FieldList($gridField),
new FieldList() new FieldList()
); );
$listview->setAttribute('data-pjax-fragment', 'ListViewForm');
$this->extend('updateListView', $listview); $this->extend('updateListView', $listview);

View File

@ -15,6 +15,13 @@ class CMSPagesController extends CMSMain {
return false; return false;
} }
/**
* @return String
*/
public function ViewState() {
return $this->request->getVar('view');
}
/** /**
* Doesn't deal with a single record, and we need * Doesn't deal with a single record, and we need
* to avoid session state from previous record edits leaking in here. * to avoid session state from previous record edits leaking in here.

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 class="cms-content-header north">
<div> <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 class="cms-content-header north">
<div> <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 class="cms-content-header north">
<div> <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 class="cms-content-header north">
<div> <div>
@ -9,10 +9,10 @@
<div class="cms-content-header-tabs"> <div class="cms-content-header-tabs">
<ul> <ul>
<li class="content-treeview"> <li class="content-treeview<% if ViewState == tree %> ui-tabs-selected<% end_if %>">
<a href="#cms-content-treeview" class="cms-panel-link" data-href="$LinkTreeView"><% _t('CMSPagesController.TreeView', 'Tree View') %></a> <a href="#cms-content-treeview" class="cms-panel-link" data-href="$LinkTreeView"><% _t('CMSPagesController.TreeView', 'Tree View') %></a>
</li> </li>
<li class="content-listview"> <li class="content-listview<% if ViewState == list %> ui-tabs-selected<% end_if %>">
<a href="#cms-content-listview" class="cms-panel-link" data-href="$LinkListView"><% _t('CMSPagesController.ListView', 'List View') %></a> <a href="#cms-content-listview" class="cms-panel-link" data-href="$LinkListView"><% _t('CMSPagesController.ListView', 'List View') %></a>
</li> </li>
<!-- <!--

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 class="cms-content-header north">
<div> <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 class="cms-content-header north">
<div> <div>