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\IRequest;
|
||||
|
||||
use OCA\Radio\Dashboard\RadioWidget;
|
||||
|
||||
class Application extends App implements IBootstrap {
|
||||
|
||||
public const APP_ID = 'radio';
|
||||
@ -22,6 +24,8 @@ class Application extends App implements IBootstrap {
|
||||
public function register(IRegistrationContext $context): void {
|
||||
|
||||
$context->registerSearchProvider(SearchProvider::class);
|
||||
$context->registerDashboardWidget(RadioWidget::class);
|
||||
|
||||
$context->registerService('request', static function ($c) {
|
||||
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"
|
||||
:title="t('radio', 'Search')" />
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<Player
|
||||
:pinned="true" />
|
||||
|
Loading…
Reference in New Issue
Block a user