Link to NC 14 dev manual
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
26e0c14c6d
commit
f07d3a3b55
|
@ -47,6 +47,7 @@ use OCP\INavigationManager;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
use OCP\IURLGenerator;
|
||||||
use OCP\L10N\IFactory;
|
use OCP\L10N\IFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,6 +78,8 @@ class AppSettingsController extends Controller {
|
||||||
private $bundleFetcher;
|
private $bundleFetcher;
|
||||||
/** @var Installer */
|
/** @var Installer */
|
||||||
private $installer;
|
private $installer;
|
||||||
|
/** @var IURLGenerator */
|
||||||
|
private $urlGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $appName
|
* @param string $appName
|
||||||
|
@ -90,8 +93,9 @@ class AppSettingsController extends Controller {
|
||||||
* @param IFactory $l10nFactory
|
* @param IFactory $l10nFactory
|
||||||
* @param BundleFetcher $bundleFetcher
|
* @param BundleFetcher $bundleFetcher
|
||||||
* @param Installer $installer
|
* @param Installer $installer
|
||||||
|
* @param IURLGenerator $urlGenerator
|
||||||
*/
|
*/
|
||||||
public function __construct($appName,
|
public function __construct(string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
IL10N $l10n,
|
IL10N $l10n,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
|
@ -101,7 +105,8 @@ class AppSettingsController extends Controller {
|
||||||
AppFetcher $appFetcher,
|
AppFetcher $appFetcher,
|
||||||
IFactory $l10nFactory,
|
IFactory $l10nFactory,
|
||||||
BundleFetcher $bundleFetcher,
|
BundleFetcher $bundleFetcher,
|
||||||
Installer $installer) {
|
Installer $installer,
|
||||||
|
IURLGenerator $urlGenerator) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -112,6 +117,7 @@ class AppSettingsController extends Controller {
|
||||||
$this->l10nFactory = $l10nFactory;
|
$this->l10nFactory = $l10nFactory;
|
||||||
$this->bundleFetcher = $bundleFetcher;
|
$this->bundleFetcher = $bundleFetcher;
|
||||||
$this->installer = $installer;
|
$this->installer = $installer;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,6 +134,7 @@ class AppSettingsController extends Controller {
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['category'] = $category;
|
$params['category'] = $category;
|
||||||
$params['appstoreEnabled'] = $this->config->getSystemValue('appstoreenabled', true) === true;
|
$params['appstoreEnabled'] = $this->config->getSystemValue('appstoreenabled', true) === true;
|
||||||
|
$params['urlGenerator'] = $this->urlGenerator;
|
||||||
$this->navigationManager->setActiveEntry('core_apps');
|
$this->navigationManager->setActiveEntry('core_apps');
|
||||||
|
|
||||||
$templateResponse = new TemplateResponse($this->appName, 'apps', $params, 'user');
|
$templateResponse = new TemplateResponse($this->appName, 'apps', $params, 'user');
|
||||||
|
|
|
@ -14,6 +14,8 @@ script(
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
/** @var array $_ */
|
/** @var array $_ */
|
||||||
|
/** @var \OCP\IURLGenerator $urlGenerator */
|
||||||
|
$urlGenerator = $_['urlGenerator'];
|
||||||
?>
|
?>
|
||||||
<script id="categories-template" type="text/x-handlebars-template">
|
<script id="categories-template" type="text/x-handlebars-template">
|
||||||
{{#each this}}
|
{{#each this}}
|
||||||
|
@ -29,7 +31,7 @@ script(
|
||||||
|
|
||||||
<?php if($_['appstoreEnabled']): ?>
|
<?php if($_['appstoreEnabled']): ?>
|
||||||
<li>
|
<li>
|
||||||
<a class="app-external icon-info" target="_blank" rel="noreferrer noopener" href="https://docs.nextcloud.org/server/12/developer_manual/"><?php p($l->t('Developer documentation'));?> ↗</a>
|
<a class="app-external icon-info" target="_blank" rel="noreferrer noopener" href="<?php p($urlGenerator->linkToDocs('developer-manual')); ?>"><?php p($l->t('Developer documentation'));?> ↗</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -30,6 +30,7 @@ use OC\Settings\Controller\AppSettingsController;
|
||||||
use OCP\AppFramework\Http\ContentSecurityPolicy;
|
use OCP\AppFramework\Http\ContentSecurityPolicy;
|
||||||
use OCP\AppFramework\Http\JSONResponse;
|
use OCP\AppFramework\Http\JSONResponse;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
use OCP\IURLGenerator;
|
||||||
use OCP\L10N\IFactory;
|
use OCP\L10N\IFactory;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
@ -66,6 +67,8 @@ class AppSettingsControllerTest extends TestCase {
|
||||||
private $bundleFetcher;
|
private $bundleFetcher;
|
||||||
/** @var Installer|\PHPUnit_Framework_MockObject_MockObject */
|
/** @var Installer|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $installer;
|
private $installer;
|
||||||
|
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
private $urlGenerator;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
@ -83,6 +86,7 @@ class AppSettingsControllerTest extends TestCase {
|
||||||
$this->l10nFactory = $this->createMock(IFactory::class);
|
$this->l10nFactory = $this->createMock(IFactory::class);
|
||||||
$this->bundleFetcher = $this->createMock(BundleFetcher::class);
|
$this->bundleFetcher = $this->createMock(BundleFetcher::class);
|
||||||
$this->installer = $this->createMock(Installer::class);
|
$this->installer = $this->createMock(Installer::class);
|
||||||
|
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
||||||
|
|
||||||
$this->appSettingsController = new AppSettingsController(
|
$this->appSettingsController = new AppSettingsController(
|
||||||
'settings',
|
'settings',
|
||||||
|
@ -95,7 +99,8 @@ class AppSettingsControllerTest extends TestCase {
|
||||||
$this->appFetcher,
|
$this->appFetcher,
|
||||||
$this->l10nFactory,
|
$this->l10nFactory,
|
||||||
$this->bundleFetcher,
|
$this->bundleFetcher,
|
||||||
$this->installer
|
$this->installer,
|
||||||
|
$this->urlGenerator
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +209,14 @@ class AppSettingsControllerTest extends TestCase {
|
||||||
$policy = new ContentSecurityPolicy();
|
$policy = new ContentSecurityPolicy();
|
||||||
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');
|
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');
|
||||||
|
|
||||||
$expected = new TemplateResponse('settings', 'apps', ['category' => 'installed', 'appstoreEnabled' => true], 'user');
|
$expected = new TemplateResponse('settings',
|
||||||
|
'apps',
|
||||||
|
[
|
||||||
|
'category' => 'installed',
|
||||||
|
'appstoreEnabled' => true,
|
||||||
|
'urlGenerator' => $this->urlGenerator,
|
||||||
|
],
|
||||||
|
'user');
|
||||||
$expected->setContentSecurityPolicy($policy);
|
$expected->setContentSecurityPolicy($policy);
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->appSettingsController->viewApps());
|
$this->assertEquals($expected, $this->appSettingsController->viewApps());
|
||||||
|
@ -224,7 +236,14 @@ class AppSettingsControllerTest extends TestCase {
|
||||||
$policy = new ContentSecurityPolicy();
|
$policy = new ContentSecurityPolicy();
|
||||||
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');
|
$policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com');
|
||||||
|
|
||||||
$expected = new TemplateResponse('settings', 'apps', ['category' => 'installed', 'appstoreEnabled' => false], 'user');
|
$expected = new TemplateResponse('settings',
|
||||||
|
'apps',
|
||||||
|
[
|
||||||
|
'category' => 'installed',
|
||||||
|
'appstoreEnabled' => false,
|
||||||
|
'urlGenerator' => $this->urlGenerator,
|
||||||
|
],
|
||||||
|
'user');
|
||||||
$expected->setContentSecurityPolicy($policy);
|
$expected->setContentSecurityPolicy($policy);
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->appSettingsController->viewApps());
|
$this->assertEquals($expected, $this->appSettingsController->viewApps());
|
||||||
|
|
Loading…
Reference in New Issue