From 1b3804ba0d8f73687c4260fbb2f20aac4470b758 Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Sat, 30 Nov 2024 02:08:27 +0200 Subject: [PATCH] feat: add admin example --- .phpactor.json | 4 ++++ appinfo/info.xml | 6 ++++- lib/Sections/CurrencyAdmin.php | 32 +++++++++++++++++++++++++ lib/Settings/CurrencyAdmin.php | 43 ++++++++++++++++++++++++++++++++++ package.json | 2 +- 5 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 .phpactor.json create mode 100644 lib/Sections/CurrencyAdmin.php create mode 100644 lib/Settings/CurrencyAdmin.php diff --git a/.phpactor.json b/.phpactor.json new file mode 100644 index 0000000..83d4ce3 --- /dev/null +++ b/.phpactor.json @@ -0,0 +1,4 @@ +{ + "$schema": "/phpactor.schema.json", + "language_server_php_cs_fixer.enabled": true +} \ No newline at end of file diff --git a/appinfo/info.xml b/appinfo/info.xml index f60dda2..46273b3 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -44,7 +44,7 @@ don't hesitate to open an appropriate issue and I will do my best to reply promp organization https://github.com/chenasraf/nextcloud-autocurrency/issues - + @@ -55,4 +55,8 @@ don't hesitate to open an appropriate issue and I will do my best to reply promp OCA\AutoCurrency\Cron\FetchCurrenciesJob + + OCA\AutoCurrency\Settings\CurrencyAdmin + OCA\AutoCurrency\Sections\CurrencyAdmin + diff --git a/lib/Sections/CurrencyAdmin.php b/lib/Sections/CurrencyAdmin.php new file mode 100644 index 0000000..09186bf --- /dev/null +++ b/lib/Sections/CurrencyAdmin.php @@ -0,0 +1,32 @@ +l = $l; + $this->urlGenerator = $urlGenerator; + } + + public function getIcon(): string { + return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg'); + } + + public function getID(): string { + return 'autocurrency'; + } + + public function getName(): string { + return $this->l->t('Notes tutorial'); + } + + public function getPriority(): int { + return 98; + } +} diff --git a/lib/Settings/CurrencyAdmin.php b/lib/Settings/CurrencyAdmin.php new file mode 100644 index 0000000..7015ca6 --- /dev/null +++ b/lib/Settings/CurrencyAdmin.php @@ -0,0 +1,43 @@ +config = $config; + $this->l = $l; + } + + /** + * @return TemplateResponse + */ + public function getForm() { + $parameters = [ + 'mySetting' => $this->config->getSystemValue('my_notes_setting', true), + ]; + + return new TemplateResponse('settings', 'settings/admin', $parameters, ''); + } + + public function getSection() { + return 'autocurrency'; // Name of the previously created section. + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 10; + } +} diff --git a/package.json b/package.json index 9d6362f..62e3aa9 100755 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "extends @nextcloud/browserslist-config" ], "engines": { - "node": "^16.0.0", + "node": ">=20.0.0", "npm": "^7.0.0 || ^8.0.0" }, "devDependencies": {