Skip to content

Commit

Permalink
Update docs de_de.lang, enable Docs page
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr-w committed Apr 6, 2024
1 parent bf6dddd commit 2d7409c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lang/de_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ respondo_entry_yform_table_dataset_id = Datensatz-ID
respondo_entry_yform_table_key = YForm-Tabelle
respondo_table_key_empty = Ohne YForm-Tabelle

# Docs

respondo_docs_intro = Intro
respondo_docs_comments = Kommentare
respondo_docs_threads = Threads
respondo_docs_reviews = Rezensionen
respondo_docs_guestbook = Gästebuch
respondo_docs_moderation = Moderation
respondo_docs_spam = Spam
respondo_docs_settings = Einstellungen
respondo_docs_fragments = Fragmente

# Moderation

respondo_moderation_delete = Löschen
Expand Down
1 change: 0 additions & 1 deletion package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ pages:
perm: admin
docs:
title: translate:respondo_docs
subPath: README.md
icon: rex-icon fa-info-circle
itemclass: pull-right
perm: respondo[docs]
Expand Down
48 changes: 48 additions & 0 deletions pages/docs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* @var rex_addon $this
* @psalm-scope-this rex_addon
*/

$mdFiles = [];
foreach (glob(rex_addon::get('respondo')->getPath('docs') . '/*.md') ?: [] as $file) {
$mdFiles[mb_substr(basename($file), 0, -3)] = $file;
}

$currenMDFile = rex_request('mdfile', 'string', '01_intro');
if (!array_key_exists($currenMDFile, $mdFiles)) {
$currenMDFile = '01_intro';
}

$page = rex_be_controller::getPageObject('respondo/docs');

if (null !== $page) {
foreach ($mdFiles as $key => $mdFile) {
$keyWithoudPrio = mb_substr($key, 3);
$currenMDFileWithoudPrio = mb_substr($currenMDFile, 3);
$page->addSubpage(
(new rex_be_page($key, rex_i18n::msg('respondo_docs_' . $keyWithoudPrio)))
->setSubPath($mdFile)
->setHref('index.php?page=respondo/docs&mdfile=' . $key)
->setIsActive($key == $currenMDFile),
);
}
}

echo rex_view::title($this->i18n('respondo_title'));

[$Toc, $Content] = rex_markdown::factory()->parseWithToc(rex_file::require($mdFiles[$currenMDFile]), 2, 3, [
rex_markdown::SOFT_LINE_BREAKS => false,
rex_markdown::HIGHLIGHT_PHP => true,
]);

$fragment = new rex_fragment();
$fragment->setVar('content', $Content, false);
$fragment->setVar('toc', $Toc, false);
$content = $fragment->parse('core/page/docs.php');

$fragment = new rex_fragment();
$fragment->setVar('title', rex_i18n::msg('package_help') . ' ', false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');

0 comments on commit 2d7409c

Please sign in to comment.