Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
Merge branch 'fixsearch'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wilr committed Dec 16, 2014
2 parents 2257e0f + 473b830 commit d92fb96
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 19 deletions.
8 changes: 3 additions & 5 deletions code/DocumentationManifest.php
Expand Up @@ -121,11 +121,9 @@ public function setupEntities() {
$path = $this->getRealPath($details['Path']);

$key = (isset($details['Key'])) ? $details['Key'] : $details['Title'];

if($path && !is_dir($path)) {
throw new Exception($path . ' is not a valid documentation directory');
} else if(!$path) {
return;

if(!$path || !is_dir($path)) {
throw new Exception($details['Path'] . ' is not a valid documentation directory');
}

$version = (isset($details['Version'])) ? $details['Version'] : '';
Expand Down
18 changes: 9 additions & 9 deletions code/forms/DocumentationAdvancedSearchForm.php
Expand Up @@ -8,11 +8,11 @@ class DocumentationAdvancedSearchForm extends Form {
public function __construct($controller) {
$versions = $controller->getManifest()->getAllVersions();
$entities = $controller->getManifest()->getEntities();

$q = ($q = $controller->getSearchQuery()) ? $q->NoHTML() : "";

// 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
$searchedEntities = $controller->getSearchedEntities();
Expand All @@ -27,21 +27,21 @@ public function __construct($controller) {
$searchedVersions = $versions;
}

$fields = new FieldList(
new TextField('q', _t('DocumentationViewer.KEYWORDS', 'Keywords'), $q),
new CheckboxSetField('Entities', _t('DocumentationViewer.MODULES', 'Modules'), $entities, $searchedEntities),
new CheckboxSetField(
$fields = FieldList::create(
TextField::create('q', _t('DocumentationViewer.KEYWORDS', 'Keywords'), $q),
//CheckboxSetField::create('Entities', _t('DocumentationViewer.MODULES', 'Modules'), $entities, $searchedEntities),
CheckboxSetField::create(
'Versions',
_t('DocumentationViewer.VERSIONS', 'Versions'),
$versions, $searchedVersions
)
);

$actions = new FieldList(
new FormAction('results', _t('DocumentationViewer.SEARCH', 'Search'))
$actions = FieldList::create(
FormAction::create('results', _t('DocumentationViewer.SEARCH', 'Search'))
);

$required = new RequiredFields(array('Search'));
$required = RequiredFields::create(array('Search'));

parent::__construct(
$controller,
Expand Down
9 changes: 8 additions & 1 deletion code/forms/DocumentationSearchForm.php
Expand Up @@ -3,9 +3,16 @@
class DocumentationSearchForm extends Form {

public function __construct($controller) {
$versions = HiddenField::create(
'Versions',
_t('DocumentationViewer.VERSIONS', 'Versions'),
implode(',', $controller->getManifest()->getAllVersions())
);

$fields = new FieldList(
TextField::create('q', _t('DocumentationViewer.SEARCH', 'Search'), '')
->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search'))
->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search')),
$versions
);

$actions = new FieldList(
Expand Down
4 changes: 2 additions & 2 deletions code/tasks/RebuildLuceneDocsIndex.php
Expand Up @@ -48,7 +48,7 @@ public function rebuildIndexes($quiet = false) {
$index->removeReference();
}
catch (Zend_Search_Lucene_Exception $e) {
// user_error($e);
user_error($e);
}

try {
Expand All @@ -61,7 +61,7 @@ public function rebuildIndexes($quiet = false) {
// includes registration
$manifest = new DocumentationManifest(true);
$pages = $manifest->getPages();

if($pages) {
$count = 0;

Expand Down
2 changes: 2 additions & 0 deletions javascript/DocumentationViewer.js
Expand Up @@ -186,8 +186,10 @@
return false;
}, 100));
};
});
*/

/** ---------------------------------------------
* LANGAUGE SELECTER
*
Expand Down
47 changes: 47 additions & 0 deletions templates/DocumentationViewer_all.ss
@@ -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 changes: 47 additions & 0 deletions templates/DocumentationViewer_results.ss
@@ -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>
2 changes: 0 additions & 2 deletions templates/Layout/DocumentationViewer_all.ss
@@ -1,6 +1,4 @@
<div id="documentation_index" class="box">
<h1>Documentation Index</h1>

<div id="page-numbers">
<span>
<% loop $AllPages.GroupedBy(FirstLetter) %>
Expand Down

0 comments on commit d92fb96

Please sign in to comment.