Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENHANCEMENT Declaring Pjax fragments on CMS templates and forms

  • Loading branch information...
commit c9fc7cda65c7b7bb8ea358bec67a07501ce24999 1 parent 9c697f4
Ingo Schommer chillu authored
3  code/controllers/AssetAdmin.php
View
@@ -162,7 +162,7 @@ public function getEditForm($id = null, $fields = null) {
$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 @@ public function getEditForm($id = null, $fields = null) {
$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);
4 code/controllers/CMSMain.php
View
@@ -625,6 +625,7 @@ public function getEditForm($id = null, $fields = null) {
// 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 @@ public function ListViewForm() {
$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 @@ public function ListViewForm() {
new FieldList($gridField),
new FieldList()
);
+ $listview->setAttribute('data-pjax-fragment', 'ListViewForm');
$this->extend('updateListView', $listview);
2  templates/Includes/AssetAdmin_Content.ss
View
@@ -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>
2  templates/Includes/AssetAdmin_UploadContent.ss
View
@@ -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>
2  templates/Includes/CMSMain_Content.ss
View
@@ -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>
2  templates/Includes/CMSPagesController_Content.ss
View
@@ -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>
2  templates/Includes/CMSSettingsController_Content.ss
View
@@ -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>
2  templates/Includes/ReportAdmin_Content.ss
View
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.