mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
Merge branch 'fixsearch'
* fixsearch: Resolve test failures Bug with Search Entities - removing from form. Removed calls to page entity, there is none when in search controller action Conflicts: javascript/DocumentationViewer.js
This commit is contained in:
commit
d92fb96e0e
@ -122,10 +122,8 @@ class DocumentationManifest {
|
|||||||
|
|
||||||
$key = (isset($details['Key'])) ? $details['Key'] : $details['Title'];
|
$key = (isset($details['Key'])) ? $details['Key'] : $details['Title'];
|
||||||
|
|
||||||
if($path && !is_dir($path)) {
|
if(!$path || !is_dir($path)) {
|
||||||
throw new Exception($path . ' is not a valid documentation directory');
|
throw new Exception($details['Path'] . ' is not a valid documentation directory');
|
||||||
} else if(!$path) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$version = (isset($details['Version'])) ? $details['Version'] : '';
|
$version = (isset($details['Version'])) ? $details['Version'] : '';
|
||||||
|
@ -12,7 +12,7 @@ class DocumentationAdvancedSearchForm extends Form {
|
|||||||
$q = ($q = $controller->getSearchQuery()) ? $q->NoHTML() : "";
|
$q = ($q = $controller->getSearchQuery()) ? $q->NoHTML() : "";
|
||||||
|
|
||||||
// klude to take an array of objects down to a simple map
|
// klude to take an array of objects down to a simple map
|
||||||
$entities = $entities->map('Folder', 'Title');
|
$entities = $entities->map('Key', 'Title');
|
||||||
|
|
||||||
// if we haven't gone any search limit then we're searching everything
|
// if we haven't gone any search limit then we're searching everything
|
||||||
$searchedEntities = $controller->getSearchedEntities();
|
$searchedEntities = $controller->getSearchedEntities();
|
||||||
@ -27,21 +27,21 @@ class DocumentationAdvancedSearchForm extends Form {
|
|||||||
$searchedVersions = $versions;
|
$searchedVersions = $versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = new FieldList(
|
$fields = FieldList::create(
|
||||||
new TextField('q', _t('DocumentationViewer.KEYWORDS', 'Keywords'), $q),
|
TextField::create('q', _t('DocumentationViewer.KEYWORDS', 'Keywords'), $q),
|
||||||
new CheckboxSetField('Entities', _t('DocumentationViewer.MODULES', 'Modules'), $entities, $searchedEntities),
|
//CheckboxSetField::create('Entities', _t('DocumentationViewer.MODULES', 'Modules'), $entities, $searchedEntities),
|
||||||
new CheckboxSetField(
|
CheckboxSetField::create(
|
||||||
'Versions',
|
'Versions',
|
||||||
_t('DocumentationViewer.VERSIONS', 'Versions'),
|
_t('DocumentationViewer.VERSIONS', 'Versions'),
|
||||||
$versions, $searchedVersions
|
$versions, $searchedVersions
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$actions = new FieldList(
|
$actions = FieldList::create(
|
||||||
new FormAction('results', _t('DocumentationViewer.SEARCH', 'Search'))
|
FormAction::create('results', _t('DocumentationViewer.SEARCH', 'Search'))
|
||||||
);
|
);
|
||||||
|
|
||||||
$required = new RequiredFields(array('Search'));
|
$required = RequiredFields::create(array('Search'));
|
||||||
|
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
$controller,
|
$controller,
|
||||||
|
@ -3,9 +3,16 @@
|
|||||||
class DocumentationSearchForm extends Form {
|
class DocumentationSearchForm extends Form {
|
||||||
|
|
||||||
public function __construct($controller) {
|
public function __construct($controller) {
|
||||||
|
$versions = HiddenField::create(
|
||||||
|
'Versions',
|
||||||
|
_t('DocumentationViewer.VERSIONS', 'Versions'),
|
||||||
|
implode(',', $controller->getManifest()->getAllVersions())
|
||||||
|
);
|
||||||
|
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
TextField::create('q', _t('DocumentationViewer.SEARCH', 'Search'), '')
|
TextField::create('q', _t('DocumentationViewer.SEARCH', 'Search'), '')
|
||||||
->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search'))
|
->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search')),
|
||||||
|
$versions
|
||||||
);
|
);
|
||||||
|
|
||||||
$actions = new FieldList(
|
$actions = new FieldList(
|
||||||
|
@ -48,7 +48,7 @@ class RebuildLuceneDocsIndex extends BuildTask {
|
|||||||
$index->removeReference();
|
$index->removeReference();
|
||||||
}
|
}
|
||||||
catch (Zend_Search_Lucene_Exception $e) {
|
catch (Zend_Search_Lucene_Exception $e) {
|
||||||
// user_error($e);
|
user_error($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -186,8 +186,10 @@
|
|||||||
return false;
|
return false;
|
||||||
}, 100));
|
}, 100));
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** ---------------------------------------------
|
/** ---------------------------------------------
|
||||||
* LANGAUGE SELECTER
|
* LANGAUGE SELECTER
|
||||||
*
|
*
|
||||||
|
47
templates/DocumentationViewer_all.ss
Normal file
47
templates/DocumentationViewer_all.ss
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<% include DocumentationHead %>
|
||||||
|
|
||||||
|
<div id="masthead" <% if Versions %>class="has_versions"<% end_if %>>
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<div class="doc-breadcrumbs">
|
||||||
|
<p>
|
||||||
|
<a class="menu-toggle"><img src="docsviewer/images/menu.png"></a>
|
||||||
|
<a class="breadcrumb" href="$BaseHref">Documentation</a>
|
||||||
|
<span>/</span>
|
||||||
|
<a class="breadcrumb current">Index</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="wrapper">
|
||||||
|
<div id="layout" class="clearfix">
|
||||||
|
|
||||||
|
$Layout
|
||||||
|
|
||||||
|
<% include DocumentationFooter %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<% if GoogleAnalyticsCode %>
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', '$GoogleAnalyticsCode', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
</script>
|
||||||
|
<% end_if %>
|
||||||
|
|
||||||
|
<% include DocumentationEnd %>
|
||||||
|
</html>
|
47
templates/DocumentationViewer_results.ss
Normal file
47
templates/DocumentationViewer_results.ss
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<% include DocumentationHead %>
|
||||||
|
|
||||||
|
<div id="masthead" <% if Versions %>class="has_versions"<% end_if %>>
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<div class="doc-breadcrumbs">
|
||||||
|
<p>
|
||||||
|
<a class="menu-toggle"><img src="docsviewer/images/menu.png"></a>
|
||||||
|
<a class="breadcrumb" href="$BaseHref">Documentation</a>
|
||||||
|
<span>/</span>
|
||||||
|
<a class="breadcrumb current">Search</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="wrapper">
|
||||||
|
<div id="layout" class="clearfix">
|
||||||
|
|
||||||
|
$Layout
|
||||||
|
|
||||||
|
<% include DocumentationFooter %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<% if GoogleAnalyticsCode %>
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', '$GoogleAnalyticsCode', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
</script>
|
||||||
|
<% end_if %>
|
||||||
|
|
||||||
|
<% include DocumentationEnd %>
|
||||||
|
</html>
|
@ -1,6 +1,4 @@
|
|||||||
<div id="documentation_index" class="box">
|
<div id="documentation_index" class="box">
|
||||||
<h1>Documentation Index</h1>
|
|
||||||
|
|
||||||
<div id="page-numbers">
|
<div id="page-numbers">
|
||||||
<span>
|
<span>
|
||||||
<% loop $AllPages.GroupedBy(FirstLetter) %>
|
<% loop $AllPages.GroupedBy(FirstLetter) %>
|
||||||
|
Loading…
Reference in New Issue
Block a user