Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into 3.0 (one-off)
This is a one-off merge in the direction master->3.0,
to ensure all bugfixes since we branched off find
their way into the next micro/minor release.
From now on, we'll commit to the latest release branch,
and merge back to master. API changes should go into
the master branch (not merged into a release branch).
  • Loading branch information
chillu committed Jul 5, 2012
2 parents 040f780 + d1bc721 commit c1aad0d
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 15 deletions.
3 changes: 2 additions & 1 deletion code/controllers/AssetAdmin.php
Expand Up @@ -146,7 +146,8 @@ public function getEditForm($id = null, $fields = null) {
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);
Expand Down
6 changes: 4 additions & 2 deletions code/controllers/CMSMain.php
Expand Up @@ -669,14 +669,16 @@ public function getList($params, $parentID = 0) {
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);
Expand Down
4 changes: 3 additions & 1 deletion code/controllers/CMSPageAddController.php
Expand Up @@ -122,7 +122,9 @@ public function doAdd($data, $form) {
}

$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();
Expand Down
4 changes: 2 additions & 2 deletions code/model/SiteTree.php
Expand Up @@ -2704,8 +2704,8 @@ function provideI18nEntities() {
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'),
Expand Down
12 changes: 6 additions & 6 deletions javascript/SiteTreeURLSegmentField.js
Expand Up @@ -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);}
);

},
Expand Down
17 changes: 14 additions & 3 deletions lang/en.yml
Expand Up @@ -37,6 +37,8 @@ en:
Back: Back
BasicFieldsTestPage:
DESCRIPTION: 'Generic content page'
BigFamilyPage:
DESCRIPTION: 'Generic content page'
BrokenLinksReport:
Any: Any
BROKENLINKS: 'Broken links report'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -211,13 +214,24 @@ en:
GridFieldTestPage:
DESCRIPTION: 'Generic content page'
LeftAndMain:
DELETED: Deleted.
PreviewButton: Preview
SAVEDUP: Saved.
STATUSPUBLISHEDSUCCESS: 'Published ''{title}'' successfully'
SearchResults: 'Search Results'
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:
Expand Down Expand Up @@ -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'
Expand All @@ -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
Expand Down
19 changes: 19 additions & 0 deletions tests/model/SiteTreeTest.php
Expand Up @@ -891,6 +891,25 @@ function testModifyStatusFlagByInheritance(){
$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'));
}

}

Expand Down

0 comments on commit c1aad0d

Please sign in to comment.