diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index 57807b21..c215c299 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -146,7 +146,8 @@ JS new GridFieldPaginator(15), new GridFieldEditButton(), new GridFieldDeleteAction(), - new GridFieldDetailForm() + new GridFieldDetailForm(), + GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d') ); $gridField = new GridField('File', $title, $this->getList(), $gridFieldConfig); diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index f50bafe2..3a88b006 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -669,14 +669,16 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr public function ListViewForm() { $params = $this->request->requestVar('q'); $list = $this->getList($params, $parentID = $this->request->requestVar('ParentID')); - $gridFieldConfig = GridFieldConfig::create()->addComponents( + $gridFieldConfig = GridFieldConfig::create()->addComponents( new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(15) ); if($parentID){ $gridFieldConfig->addComponent( - new GridFieldLevelup($parentID) + GridFieldLevelup::create($parentID) + ->setLinkSpec('?ParentID=%d&view=list') + ->setAttributes(array('data-pjax' => 'ListViewForm,Breadcrumbs')) ); } $gridField = new GridField('Page','Pages', $list, $gridFieldConfig); diff --git a/code/controllers/CMSPageAddController.php b/code/controllers/CMSPageAddController.php index 502c0dce..81b17292 100644 --- a/code/controllers/CMSPageAddController.php +++ b/code/controllers/CMSPageAddController.php @@ -122,7 +122,9 @@ class CMSPageAddController extends CMSPageEditController { } $record = $this->getNewItem("new-$className-$parentID".$suffix, false); - if(class_exists('Translatable') && $record->hasExtension('Translatable')) $record->Locale = $data['Locale']; + if(class_exists('Translatable') && $record->hasExtension('Translatable') && isset($data['Locale'])) { + $record->Locale = $data['Locale']; + } try { $record->write(); diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 6704b8db..18620015 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -2704,8 +2704,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = FRAMEWORK_DIR; if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = FRAMEWORK_DIR; - $types = self::page_type_classes(); - foreach($types as $type) { + $types = ClassInfo::subclassesFor('SiteTree'); + foreach($types as $k => $type) { $inst = singleton($type); $entities[$type . '.DESCRIPTION'] = array( $inst->stat('description'), diff --git a/javascript/SiteTreeURLSegmentField.js b/javascript/SiteTreeURLSegmentField.js index 086e4e7b..83365a00 100644 --- a/javascript/SiteTreeURLSegmentField.js +++ b/javascript/SiteTreeURLSegmentField.js @@ -127,13 +127,13 @@ * (Function) callback */ suggest: function(val, callback) { - var field = this.find(':text'); + var field = this.find(':text'), urlParts = $.path.parseUrl(this.closest('form').attr('action')), + url = urlParts.hrefNoSearch + '/field/' + field.attr('name') + '/suggest/?value=' + encodeURIComponent(val); + if(urlParts.search) url += '&' + urlParts.search.replace(/^\?/, ''); + $.get( - this.closest('form').attr('action') + - '/field/' + field.attr('name') + '/suggest/?value=' + encodeURIComponent(val), - function(data) { - callback.apply(this, arguments); - } + url, + function(data) {callback.apply(this, arguments);} ); }, diff --git a/lang/en.yml b/lang/en.yml index 519a551c..8b2d05ee 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -37,6 +37,8 @@ en: Back: Back BasicFieldsTestPage: DESCRIPTION: 'Generic content page' + BigFamilyPage: + DESCRIPTION: 'Generic content page' BrokenLinksReport: Any: Any BROKENLINKS: 'Broken links report' @@ -91,6 +93,7 @@ en: PUBALLFUN: '"Publish All" functionality' PUBALLFUN2: "Pressing this button will do the equivalent of going to every page and pressing \"publish\". It's\n intended to be used after there have been massive edits of the content, such as when the site was\n first built." PUBPAGES: 'Done: Published {count} pages' + PageAdded: 'Successfully created page' REMOVED: 'Deleted ''%s''%s from live site' REMOVEDPAGE: 'Removed ''{title}'' from the published site' REMOVEDPAGEFROMDRAFT: 'Removed ''%s'' from the draft site' @@ -211,6 +214,7 @@ en: GridFieldTestPage: DESCRIPTION: 'Generic content page' LeftAndMain: + DELETED: Deleted. PreviewButton: Preview SAVEDUP: Saved. STATUSPUBLISHEDSUCCESS: 'Published ''{title}'' successfully' @@ -218,6 +222,16 @@ en: VersionUnknown: Unknown LegacyTableFieldsTestPage: DESCRIPTION: 'Generic content page' + MyNonRootPage: + DESCRIPTION: 'Generic content page' + MyOtherPage: + DESCRIPTION: 'Generic content page' + MyPage: + DESCRIPTION: 'Generic content page' + MyRandomPage: + DESCRIPTION: 'Generic content page' + PackageManagerPage: + DESCRIPTION: 'Generic content page' Page: DESCRIPTION: 'Generic content page' Permission: @@ -264,8 +278,6 @@ en: EDITHEADER: 'Who can edit pages on this site?' EDIT_PERMISSION: 'Manage site configuration' EDIT_PERMISSION_HELP: 'Ability to edit global access settings/top-level page permissions.' - PLURALNAME: 'Site Configs' - SINGULARNAME: 'Site Config' SITENAMEDEFAULT: 'Your Site Name' SITETAGLINE: 'Site Tagline/Slogan' SITETITLE: 'Site title' @@ -289,7 +301,6 @@ en: BUTTONSAVEPUBLISH: 'Save & Publish' BUTTONUNPUBLISH: Unpublish BUTTONUNPUBLISHDESC: 'Remove this page from the published site' - CHANGETO: 'Change to "%s"' CREATED: 'Date Created' Comments: Comments Content: Content diff --git a/tests/model/SiteTreeTest.php b/tests/model/SiteTreeTest.php index 269627b5..ea8cbcdf 100644 --- a/tests/model/SiteTreeTest.php +++ b/tests/model/SiteTreeTest.php @@ -891,6 +891,25 @@ class SiteTreeTest extends SapphireTest { $this->assertContains('InheritedTitle', $treeTitle); $this->assertContains('inherited-class', $treeTitle); } + + function testMenuTitleIsUnsetWhenEqualsTitle() { + $page = new SiteTree(); + $page->Title = 'orig'; + $page->MenuTitle = 'orig'; + $page->write(); + + // change menu title + $page->MenuTitle = 'changed'; + $page->write(); + $page = SiteTree::get()->byID($page->ID); + $this->assertEquals('changed', $page->getField('MenuTitle')); + + // change menu title back + $page->MenuTitle = 'orig'; + $page->write(); + $page = SiteTree::get()->byID($page->ID); + $this->assertEquals(null, $page->getField('MenuTitle')); + } }