beginning to implement dashboard widget
This commit is contained in:
parent
914ac91868
commit
55b419b338
@ -11,6 +11,8 @@ use OCP\AppFramework\Bootstrap\IBootstrap;
|
|||||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
|
use OCA\Radio\Dashboard\RadioWidget;
|
||||||
|
|
||||||
class Application extends App implements IBootstrap {
|
class Application extends App implements IBootstrap {
|
||||||
|
|
||||||
public const APP_ID = 'radio';
|
public const APP_ID = 'radio';
|
||||||
@ -22,6 +24,8 @@ class Application extends App implements IBootstrap {
|
|||||||
public function register(IRegistrationContext $context): void {
|
public function register(IRegistrationContext $context): void {
|
||||||
|
|
||||||
$context->registerSearchProvider(SearchProvider::class);
|
$context->registerSearchProvider(SearchProvider::class);
|
||||||
|
$context->registerDashboardWidget(RadioWidget::class);
|
||||||
|
|
||||||
$context->registerService('request', static function ($c) {
|
$context->registerService('request', static function ($c) {
|
||||||
return $c->get(IRequest::class);
|
return $c->get(IRequest::class);
|
||||||
});
|
});
|
||||||
|
63
lib/Dashboard/RadioWidget.php
Normal file
63
lib/Dashboard/RadioWidget.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OCA\Radio\Dashboard;
|
||||||
|
|
||||||
|
use OCP\Dashboard\IWidget;
|
||||||
|
use OCP\IL10N;
|
||||||
|
|
||||||
|
use OCA\Radio\AppInfo\Application;
|
||||||
|
|
||||||
|
class RadioWidget implements IWidget {
|
||||||
|
|
||||||
|
/** @var IL10N */
|
||||||
|
private $l10n;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
IL10N $l10n
|
||||||
|
) {
|
||||||
|
$this->l10n = $l10n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getId(): string {
|
||||||
|
return 'radio';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getTitle(): string {
|
||||||
|
return $this->l10n->t('Favorite Radio stations');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getOrder(): int {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getIconClass(): string {
|
||||||
|
return 'icon-radio';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getUrl(): ?string {
|
||||||
|
return \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => 'connected-accounts']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function load(): void {
|
||||||
|
\OC_Util::addScript(Application::APP_ID, Application::APP_ID . '-dashboard');
|
||||||
|
\OC_Util::addStyle(Application::APP_ID, 'dashboard');
|
||||||
|
}
|
||||||
|
}
|
@ -27,7 +27,6 @@
|
|||||||
icon="icon-search"
|
icon="icon-search"
|
||||||
:title="t('radio', 'Search')" />
|
:title="t('radio', 'Search')" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<Player
|
<Player
|
||||||
:pinned="true" />
|
:pinned="true" />
|
||||||
|
Loading…
Reference in New Issue
Block a user