From 55b419b3380f5277fa490473b4c0e2d0179e0491 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 10 Nov 2020 14:37:36 +0100 Subject: [PATCH] beginning to implement dashboard widget --- lib/AppInfo/Application.php | 4 +++ lib/Dashboard/RadioWidget.php | 63 +++++++++++++++++++++++++++++++++++ src/components/Navigation.vue | 1 - 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 lib/Dashboard/RadioWidget.php diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 3fecbeb..63cc497 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -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); }); diff --git a/lib/Dashboard/RadioWidget.php b/lib/Dashboard/RadioWidget.php new file mode 100644 index 0000000..9c5bca8 --- /dev/null +++ b/lib/Dashboard/RadioWidget.php @@ -0,0 +1,63 @@ +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'); + } +} diff --git a/src/components/Navigation.vue b/src/components/Navigation.vue index 1ade168..2f07ff5 100644 --- a/src/components/Navigation.vue +++ b/src/components/Navigation.vue @@ -27,7 +27,6 @@ icon="icon-search" :title="t('radio', 'Search')" /> -