Fixed crash caused by i18n::get_common_languages()
Fixed issue when under DevelopmentAdmin where the url parameters would not line up properly Replaced get_class() to determine type with the new getType method Relocated templates to match controller namespace
This commit is contained in:
parent
e29dabf92d
commit
90d39617f0
|
@ -5,3 +5,9 @@ SilverStripe\DocsViewer\Controllers\DocumentationViewer:
|
|||
google_analytics_code: ''
|
||||
SilverStripe\DocsViewer\DocumentationManifest:
|
||||
automatic_registration: true
|
||||
SilverStripe\Dev\DevelopmentAdmin:
|
||||
registered_controllers:
|
||||
docs:
|
||||
controller: 'SilverStripe\DocsViewer\Controllers\DocumentationViewer'
|
||||
links:
|
||||
'docs': "Documentation Viewer"
|
|
@ -23,6 +23,12 @@
|
|||
"silverstripe/staticpublisher": "Allows publishing documentation as HTML"
|
||||
},
|
||||
"extra": {
|
||||
"expose": [
|
||||
"css",
|
||||
"javascript",
|
||||
"images",
|
||||
"thirdparty"
|
||||
],
|
||||
"branch-alias": {
|
||||
"dev-master": "3.x-dev"
|
||||
}
|
||||
|
|
|
@ -49,35 +49,6 @@ page.
|
|||
See [Writing Documentation](writing-documentation)
|
||||
for more information on how to write markdown files which are available here.
|
||||
|
||||
|
||||
## Enabling Search
|
||||
|
||||
The module provides automatic search functionality via [Lucene Search](http://lucene.apache.org/java/docs/index.html).
|
||||
|
||||
To enable search you need to add the following to your applications _config.php
|
||||
file:
|
||||
|
||||
DocumentationSearch::enable();
|
||||
|
||||
After adding that line you will also need to build the indexes of the search.
|
||||
|
||||
You can do this either via your web browser by accessing
|
||||
|
||||
http://yoursite.com/dev/tasks/RebuildLuceneDocsIndex?flush=1
|
||||
|
||||
Or rebuild it via sake. You will want to set this up as a cron job if your
|
||||
documentation search needs to be updated on the fly
|
||||
|
||||
sake dev/tasks/RebuildLuceneDocsIndex flush=1
|
||||
|
||||
## Advanced Search
|
||||
|
||||
Advanced Search is enabled by default on the searchresults page, allowing you to
|
||||
extend your search over multiple modules and/or versions. Advanced search can
|
||||
be disabled from your _config.php like this:
|
||||
|
||||
DocumentationSearch::enable_advanced_search(false);
|
||||
|
||||
## Using a URL other than /dev/docs/
|
||||
|
||||
By default, the documentation is available in `dev/docs`. If you want it to
|
||||
|
|
|
@ -6,7 +6,7 @@ use SilverStripe\Control\Controller;
|
|||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Control\HTTPResponse;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Dev\DevelopmentAdmin;
|
||||
use SilverStripe\DocsViewer\DocumentationHelper;
|
||||
use SilverStripe\DocsViewer\DocumentationManifest;
|
||||
use SilverStripe\DocsViewer\DocumentationPermalinks;
|
||||
|
@ -199,6 +199,10 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
*/
|
||||
public function handleAction($request, $action)
|
||||
{
|
||||
if ($request->param('Controller') == DevelopmentAdmin::class && $request->param('Action') == 'docs') {
|
||||
$request->shiftAllParams();
|
||||
}
|
||||
|
||||
// if we submitted a form, let that pass
|
||||
if (!$request->isGET() && !$request->isHEAD()) {
|
||||
return parent::handleAction($request, $action);
|
||||
|
@ -258,7 +262,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
// as we use it for generic interfaces and language selection. If
|
||||
// language is not set, redirects to 'en'
|
||||
//
|
||||
$languages = i18n::get_common_languages();
|
||||
$languages = i18n::getData()->getLanguages();
|
||||
|
||||
if (!$lang = $request->param('Lang')) {
|
||||
$lang = $request->param('Action');
|
||||
|
@ -306,10 +310,10 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
$this->record = $record;
|
||||
$this->init();
|
||||
|
||||
$type = get_class($this->record);
|
||||
$type = $this->record->getType();
|
||||
$body = $this->renderWith(
|
||||
array(
|
||||
"DocumentationViewer_{$type}",
|
||||
DocumentationViewer::class . "_{$type}",
|
||||
DocumentationViewer::class
|
||||
)
|
||||
);
|
||||
|
@ -322,7 +326,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
} elseif (!$url || $url == $lang) {
|
||||
$body = $this->renderWith(
|
||||
array(
|
||||
'DocumentationViewer_DocumentationFolder',
|
||||
DocumentationViewer::class . '_DocumentationFolder',
|
||||
DocumentationViewer::class
|
||||
)
|
||||
);
|
||||
|
@ -362,7 +366,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
public function getManifest()
|
||||
{
|
||||
if (!$this->manifest) {
|
||||
$flush = SapphireTest::is_running_test() || (isset($_GET['flush']));
|
||||
$flush = Director::isTest() || (isset($_GET['flush']));
|
||||
|
||||
$this->manifest = new DocumentationManifest($flush);
|
||||
}
|
||||
|
@ -505,7 +509,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
'Children' => $children
|
||||
)
|
||||
)
|
||||
)->renderWith('Includes/DocumentationPages');
|
||||
)->renderWith('SilverStripe/DocsViewer/Controllers/Includes/DocumentationPages');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<% include DocumentationHead %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationHead %>
|
||||
|
||||
<div id="masthead" <% if Versions %>class="has_versions"<% end_if %>>
|
||||
<div class="wrapper">
|
||||
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
|
||||
<% if Breadcrumbs.count > 1 %>
|
||||
<% include DocumentationBreadcrumbs %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationBreadcrumbs %>
|
||||
<% else_if Page.Title %>
|
||||
<h1>$Page.Title</h1>
|
||||
<% end_if %>
|
||||
|
@ -23,24 +23,24 @@
|
|||
</div>
|
||||
<% end_if %>
|
||||
|
||||
<% include DocumentationVersions %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationVersions %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<div id="layout" class="clearfix">
|
||||
|
||||
<% include DocumentationSidebar %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationSidebar %>
|
||||
|
||||
<div id="content">
|
||||
$Layout
|
||||
|
||||
<% include DocumentationFooter %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationFooter %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% include DocumentationGA %>
|
||||
<% include DocumentationEnd %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationGA %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationEnd %>
|
||||
</html>
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<% include DocumentationHead %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationHead %>
|
||||
|
||||
<div id="masthead" <% if Versions %>class="has_versions"<% end_if %>>
|
||||
<div class="wrapper">
|
||||
|
@ -24,12 +24,12 @@
|
|||
|
||||
$Layout
|
||||
|
||||
<% include DocumentationFooter %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationFooter %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% include DocumentationGA %>
|
||||
<% include DocumentationEnd %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationGA %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationEnd %>
|
||||
</html>
|
|
@ -9,21 +9,21 @@
|
|||
</div>
|
||||
|
||||
<% if Breadcrumbs %>
|
||||
<% include DocumentationBreadcrumbs %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationBreadcrumbs %>
|
||||
<% end_if %>
|
||||
<% else %>
|
||||
<% if Breadcrumbs %>
|
||||
<% include DocumentationBreadcrumbs %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationBreadcrumbs %>
|
||||
<% end_if %>
|
||||
|
||||
<h1>$Title</h1>
|
||||
<% end_if %>
|
||||
|
||||
<% if VersionWarning %>
|
||||
<% include DocumentationVersion_warning %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationVersion_warning %>
|
||||
<% end_if %>
|
||||
|
||||
<% include DocumentationTableContents %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationTableContents %>
|
||||
|
||||
<% if Children %>
|
||||
<div class="documentation_children">
|
||||
|
@ -49,5 +49,5 @@
|
|||
</div>
|
||||
<% end_if %>
|
||||
|
||||
<% include DocumentationNextPrevious %>
|
||||
<% include SilverStripe\\DocsViewer\\Controllers\\DocumentationNextPrevious %>
|
||||
</div>
|
Loading…
Reference in New Issue