Files
quicknotes/lib/AppInfo/DashboardWidget.php
Matias De lellis b6db15d8d2 Add dashboard widget to show the latest notes. Issue #51
p.s: I would like to be able to select a particular tag to show, but
none of the dashboard widgets are configurable.

I hate increasing the app size from 300k to almost 3 mb for something
so simple, but we must adapt to the majority and use vue here.
2022-05-25 10:29:20 -03:00

65 lines
1013 B
PHP

<?php
declare(strict_types=1);
namespace OCA\QuickNotes\AppInfo;
use OCP\Dashboard\IWidget;
use OCP\IL10N;
use OCP\IURLGenerator;
class DashboardWidget implements IWidget {
private IURLGenerator $url;
private IL10N $l10n;
public function __construct(IURLGenerator $url,
IL10N $l10n)
{
$this->url = $url;
$this->l10n = $l10n;
}
/**
* @inheritDoc
*/
public function getId(): string {
return 'quicknotes';
}
/**
* @inheritDoc
*/
public function getTitle(): string {
return $this->l10n->t('Quick notes');
}
/**
* @inheritDoc
*/
public function getOrder(): int {
return 30;
}
/**
* @inheritDoc
*/
public function getIconClass(): string {
return 'icon-quicknotes';
}
/**
* @inheritDoc
*/
public function getUrl(): ?string {
return $this->url->linkToRouteAbsolute('quicknotes.page.index');
}
/**
* @inheritDoc
*/
public function load(): void {
\OCP\Util::addScript('quicknotes', 'quicknotes-dashboard');
}
}