Implement draft general documentation

This commit is contained in:
Dennis Eichhorn 2018-07-06 21:01:22 +02:00
parent 97c4484c0b
commit dc43e0edd5
2 changed files with 30 additions and 4 deletions

View File

@ -116,9 +116,25 @@ final class Controller extends ModuleAbstract implements WebInterface
public function viewHelpGeneral(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Help/Theme/Backend/help-general');
$view->setData('markdown', Markdown::parse(file_get_contents(__DIR__ . '/../../Documentation/README.md')));
if ($request->getData('page') === 'README' || $request->getData('page') === null) {
$path = \realpath(__DIR__ . '/../../Documentation/README.md');
} else {
$path = \realpath(__DIR__ . '/../../Documentation/' . $request->getData('page') . '.md');
}
if ($path === false) {
$view->setTemplate('/Web/Backend/Error/403_inline');
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
return $view;
}
$content = Markdown::parse(\file_get_contents($path));
$navigation = Markdown::parse(\file_get_contents(__DIR__ . '/../../Documentation/SUMMARY.md'));
$view->setTemplate('/Modules/Help/Theme/Backend/help-general');
$view->setData('content', $content);
$view->setData('navigation', $navigation);
return $view;
}

View File

@ -1,9 +1,19 @@
<div class="row">
<div class="col-xs-12">
<div class="col-xs-12 col-md-8 col-lg-9">
<section class="box wf-100">
<div class="inner">
<article>
<?= $this->getData('markdown'); ?>
<?= $this->getData('content'); ?>
</article>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4 col-lg-3">
<section class="box wf-100">
<div class="inner">
<article>
<?= $this->getData('navigation'); ?>
</article>
</div>
</section>