Skip to content

Commit

Permalink
Move inline docs to online documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed Oct 5, 2023
1 parent f3f2d9b commit 3ecd587
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 62 deletions.
35 changes: 25 additions & 10 deletions apps/settings/css/help.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
.help-includes {
overflow: hidden !important;
}

.help-list__text {
margin-left: 24px;
}

.help-iframe {
width: 100%;
.help-wrapper {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
margin: 0;
padding: 0;
border: 0;
overflow: auto;
width: 100%;
}

.help-content__heading {
text-align: center;
padding: 20px;
}

.help-content {
display: block;
padding: 20px;
}

.help-content__body {
display: flex;
justify-content: center;
align-items: center;
}

.help-content__body > a {
margin: 20px;
}
12 changes: 2 additions & 10 deletions apps/settings/lib/Controller/HelpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,16 @@ public function help(string $mode = 'user'): TemplateResponse {
$mode = 'user';
}

$documentationUrl = $this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkTo('', 'core/doc/' . $mode . '/index.html')
);

$urlUserDocs = $this->urlGenerator->linkToRoute('settings.Help.help', ['mode' => 'user']);
$urlAdminDocs = $this->urlGenerator->linkToRoute('settings.Help.help', ['mode' => 'admin']);
$urlUserDocs = $this->urlGenerator->linkToDocs('user');
$urlAdminDocs = $this->urlGenerator->linkToDocs('admin');

$response = new TemplateResponse('settings', 'help', [
'admin' => $this->groupManager->isAdmin($this->userId),
'url' => $documentationUrl,
'urlUserDocs' => $urlUserDocs,
'urlAdminDocs' => $urlAdminDocs,
'mode' => $mode,
'pageTitle' => $pageTitle,
]);
$policy = new ContentSecurityPolicy();
$policy->addAllowedFrameDomain('\'self\'');
$response->setContentSecurityPolicy($policy);
return $response;
}
}
60 changes: 22 additions & 38 deletions apps/settings/templates/help.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,32 @@
<?php
\OC_Util::addStyle('settings', 'help');
?>
<div id="app-navigation" role="navigation" tabindex="0">
<ul>
<li>
<a class="icon-user <?php if ($_['mode'] === 'user') {
p('active');
} ?>" <?php if ($_['mode'] === 'user') { print_unescaped('aria-current="page"'); } ?>

<div id="app-content">
<div class="help-wrapper">
<div class="help-content">
<h2 class="help-content__heading">
<?php p($l->t('Nextcloud documentation overview')); ?>
</h2>
<div class="help-content__body">
<a class="button <?php if ($_['mode'] === 'user') {
p('active');
} ?>" <?php if ($_['mode'] === 'user') { print_unescaped('target="_blank" rel="noreferrer noopener"'); } ?>
href="<?php print_unescaped($_['urlUserDocs']); ?>">
<span class="help-list__text">
<?php p($l->t('User documentation')); ?>
</span>
<?php p($l->t('User documentation')); ?>
</a>
</li>
<?php if ($_['admin']) { ?>
<li>
<a class="icon-user-admin <?php if ($_['mode'] === 'admin') {
p('active');
} ?>" <?php if ($_['mode'] === 'admin') { print_unescaped('aria-current="page"'); } ?>
<a class="button <?php if ($_['mode'] === 'admin') {
p('active');
} ?>" <?php if ($_['mode'] === 'admin') { print_unescaped('target="_blank" rel="noreferrer noopener"'); } ?>
href="<?php print_unescaped($_['urlAdminDocs']); ?>">
<span class="help-list__text">
<?php p($l->t('Administrator documentation')); ?>
</span>
<?php p($l->t('Administrator documentation')); ?>
</a>
</li>
<?php } ?>

<li>
<a href="https://docs.nextcloud.com" class="icon-category-office" target="_blank" rel="noreferrer noopener">
<span class="help-list__text">
<?php p($l->t('Documentation')); ?>
</span>
<a href="https://docs.nextcloud.com" class="button" target="_blank" rel="noreferrer noopener">
<?php p($l->t('General documentation')); ?>
</a>
</li>
<li>
<a href="https://help.nextcloud.com" class="icon-comment" target="_blank" rel="noreferrer noopener">
<span class="help-list__text">
<?php p($l->t('Forum')); ?>
</span>
<a href="https://help.nextcloud.com" class="button" target="_blank" rel="noreferrer noopener">
<?php p($l->t('Forum')); ?>
</a>
</li>
</div>

<div id="app-content" class="help-includes">
<iframe src="<?php print_unescaped($_['url']); ?>" class="help-iframe" tabindex="0">
</iframe>
</div>
</div>
</div>
2 changes: 0 additions & 2 deletions core/doc/admin/index.html

This file was deleted.

2 changes: 0 additions & 2 deletions core/doc/user/index.html

This file was deleted.

0 comments on commit 3ecd587

Please sign in to comment.