mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT Testing new File.ShowInSearch flag, and adding it to AssetTableField view
This commit is contained in:
parent
ad88e28907
commit
2693f675db
@ -195,6 +195,13 @@ class AssetTableField extends ComplexTableField {
|
||||
);
|
||||
}
|
||||
|
||||
if(!($childData instanceof Folder)) {
|
||||
$mainTab->addFieldToTab(
|
||||
'BottomRoot.Main',
|
||||
new CheckboxField("ShowInSearch", $childData->fieldLabel('ShowInSearch'))
|
||||
);
|
||||
}
|
||||
|
||||
if($childData && $childData->hasMethod('BackLinkTracking')) {
|
||||
if(class_exists('Subsite')) Subsite::disable_subsite_filter(true);
|
||||
$links = $childData->BackLinkTracking();
|
||||
|
@ -170,7 +170,7 @@ class SearchFormTest extends FunctionalTest {
|
||||
$member->logOut();
|
||||
}
|
||||
|
||||
function testDisabledShowInSearchFlagNotIncluded() {
|
||||
function testDisabledShowInSearchFlagNotIncludedForSiteTree() {
|
||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||
|
||||
$page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage');
|
||||
@ -182,6 +182,26 @@ class SearchFormTest extends FunctionalTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testDisabledShowInSearchFlagNotIncludedForFiles() {
|
||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||
|
||||
$dontShowInSearchFile = $this->objFromFixture('File', 'dontShowInSearchFile');
|
||||
$showInSearchFile = $this->objFromFixture('File', 'showInSearchFile');
|
||||
$results = $sf->getResults(null, array('Search'=>'dontShowInSearchFile'));
|
||||
$this->assertNotContains(
|
||||
$dontShowInSearchFile->ID,
|
||||
$results->column('ID'),
|
||||
'File with "Show in Search" disabled doesnt show'
|
||||
);
|
||||
|
||||
$results = $sf->getResults(null, array('Search'=>'showInSearchFile'));
|
||||
$this->assertContains(
|
||||
$showInSearchFile->ID,
|
||||
$results->column('ID'),
|
||||
'File with "Show in Search" enabled can be found'
|
||||
);
|
||||
}
|
||||
|
||||
function testSearchTitleAndContentWithSpecialCharacters() {
|
||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||
|
||||
|
@ -34,3 +34,10 @@ SiteTree:
|
||||
pageWithSpecialChars:
|
||||
Title: Brötchen
|
||||
Content: Frisch vom Bäcker
|
||||
File:
|
||||
showInSearchFile:
|
||||
Title: showInSearchFile
|
||||
ShowInSearch: 1
|
||||
dontShowInSearchFile:
|
||||
Title: dontShowInSearchFile
|
||||
ShowInSearch: 0
|
Loading…
Reference in New Issue
Block a user