mirror of
https://github.com/Karaka-Management/oms-Help.git
synced 2026-02-14 03:58:40 +00:00
impl. dev help documentation
This commit is contained in:
parent
5bc2a55186
commit
911e5e6810
|
|
@ -155,15 +155,18 @@ final class BackendController extends Controller
|
||||||
$view = new View($this->app->l11nManager, $request, $response);
|
$view = new View($this->app->l11nManager, $request, $response);
|
||||||
$path = $this->getHelpModulePath($request);
|
$path = $this->getHelpModulePath($request);
|
||||||
|
|
||||||
$toParse = \file_get_contents($path);
|
$toParse = \file_get_contents($path);
|
||||||
$summary = \file_get_contents(__DIR__ . '/../../' . $request->getData('id') . '/Docs/Help/en/SUMMARY.md');
|
$summary = \file_get_contents(__DIR__ . '/../../' . $request->getData('id') . '/Docs/Help/en/SUMMARY.md');
|
||||||
|
$devSummary = \file_get_contents(__DIR__ . '/../../' . $request->getData('id') . '/Docs/Dev/en/SUMMARY.md');
|
||||||
|
|
||||||
$content = Markdown::parse($toParse === false ? '' : $toParse);
|
$content = Markdown::parse($toParse === false ? '' : $toParse);
|
||||||
$navigation = Markdown::parse($summary === false ? '' : $summary);
|
$navigation = Markdown::parse($summary === false ? '' : $summary);
|
||||||
|
$devNavigation = $devSummary === false ? null : Markdown::parse($devSummary);
|
||||||
|
|
||||||
$view->setTemplate('/Modules/Help/Theme/Backend/help-module');
|
$view->setTemplate('/Modules/Help/Theme/Backend/help-module');
|
||||||
$view->setData('content', $content);
|
$view->setData('content', $content);
|
||||||
$view->setData('navigation', $navigation);
|
$view->setData('navigation', $navigation);
|
||||||
|
$view->setData('devNavigation', $devNavigation);
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
@ -180,15 +183,18 @@ final class BackendController extends Controller
|
||||||
*/
|
*/
|
||||||
private function getHelpModulePath(RequestAbstract $request) : string
|
private function getHelpModulePath(RequestAbstract $request) : string
|
||||||
{
|
{
|
||||||
|
$type = '';
|
||||||
if ($request->getData('page') === 'table-of-contencts' || $request->getData('page') === null) {
|
if ($request->getData('page') === 'table-of-contencts' || $request->getData('page') === null) {
|
||||||
$page = 'introduction';
|
$page = 'introduction';
|
||||||
} else {
|
} else {
|
||||||
$page = $request->getData('page');
|
$typePos = \stripos($request->getData('page'), '/');
|
||||||
|
$page = \substr($request->getData('page'), $typePos + 1);
|
||||||
|
$type = \substr($request->getData('page'), 0, $typePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = \realpath(__DIR__ . '/../../' . $request->getData('id') . '/Docs/Help/en/' . $page . '.md');
|
$path = \realpath(__DIR__ . '/../../' . $request->getData('id') . '/Docs/' . $type . '/' . $request->getHeader()->getL11n()->getLanguage() . '/' . $page . '.md');
|
||||||
if ($path === false) {
|
if ($path === false) {
|
||||||
$path = \realpath(__DIR__ . '/../../' . $request->getData('id') . '/Docs/Help/en/introduction.md');
|
$path = \realpath(__DIR__ . '/../../' . $request->getData('id') . '/Docs/' . $type . '/' . $request->getHeader()->getL11n()->getLanguage() . '/introduction.md');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $path === false ? '' : $path;
|
return $path === false ? '' : $path;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# Table of Contents
|
# User Content
|
||||||
|
|
||||||
* [Documentation]({%}&page=documentation)
|
* [Documentation]({%}&page=Help/documentation)
|
||||||
|
|
@ -9,9 +9,9 @@ Mandatory files are a `SUMMARY.md` file which contains the list of all documents
|
||||||
```md
|
```md
|
||||||
# Table of Contents
|
# Table of Contents
|
||||||
|
|
||||||
* [Link Name 1]({%}&page=document_name_1)
|
* [Link Name 1]({%}&page=Help/document_name_1)
|
||||||
* [Link Name 2]({%}&page=document_name_2)
|
* [Link Name 2]({%}&page=Help/document_name_2)
|
||||||
* [Link Name 3]({%}&page=document_name_3)
|
* [Link Name 3]({%}&page=Help/document_name_3)
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
@ -17,5 +17,13 @@
|
||||||
<?= $this->getData('navigation'); ?>
|
<?= $this->getData('navigation'); ?>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<?php if ($this->hasData('devNavigation')) : ?>
|
||||||
|
<section class="box wf-100">
|
||||||
|
<article>
|
||||||
|
<?= $this->getData('devNavigation'); ?>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Loading…
Reference in New Issue
Block a user