mirror of
https://github.com/chenasraf/nextcloud-autocurrency.git
synced 2026-05-17 17:28:06 +00:00
feat: add admin example
This commit is contained in:
4
.phpactor.json
Normal file
4
.phpactor.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"$schema": "/phpactor.schema.json",
|
||||||
|
"language_server_php_cs_fixer.enabled": true
|
||||||
|
}
|
||||||
@@ -44,7 +44,7 @@ don't hesitate to open an appropriate issue and I will do my best to reply promp
|
|||||||
<category>organization</category>
|
<category>organization</category>
|
||||||
<bugs>https://github.com/chenasraf/nextcloud-autocurrency/issues</bugs>
|
<bugs>https://github.com/chenasraf/nextcloud-autocurrency/issues</bugs>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="25" max-version="25"/>
|
<nextcloud min-version="25" max-version="30"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<navigations>
|
<navigations>
|
||||||
<navigation>
|
<navigation>
|
||||||
@@ -55,4 +55,8 @@ don't hesitate to open an appropriate issue and I will do my best to reply promp
|
|||||||
<background-jobs>
|
<background-jobs>
|
||||||
<job>OCA\AutoCurrency\Cron\FetchCurrenciesJob</job>
|
<job>OCA\AutoCurrency\Cron\FetchCurrenciesJob</job>
|
||||||
</background-jobs>
|
</background-jobs>
|
||||||
|
<settings>
|
||||||
|
<admin>OCA\AutoCurrency\Settings\CurrencyAdmin</admin>
|
||||||
|
<admin-section>OCA\AutoCurrency\Sections\CurrencyAdmin</admin-section>
|
||||||
|
</settings>
|
||||||
</info>
|
</info>
|
||||||
|
|||||||
32
lib/Sections/CurrencyAdmin.php
Normal file
32
lib/Sections/CurrencyAdmin.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\AutoCurrency\Sections;
|
||||||
|
|
||||||
|
use OCP\IL10N;
|
||||||
|
use OCP\IURLGenerator;
|
||||||
|
use OCP\Settings\IIconSection;
|
||||||
|
|
||||||
|
class CurrencyAdmin implements IIconSection {
|
||||||
|
private IL10N $l;
|
||||||
|
private IURLGenerator $urlGenerator;
|
||||||
|
|
||||||
|
public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
|
||||||
|
$this->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
43
lib/Settings/CurrencyAdmin.php
Normal file
43
lib/Settings/CurrencyAdmin.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\AutoCurrency\Settings;
|
||||||
|
|
||||||
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
use OCP\IConfig;
|
||||||
|
use OCP\IL10N;
|
||||||
|
use OCP\Settings\ISettings;
|
||||||
|
|
||||||
|
class CurrencyAdmin implements ISettings {
|
||||||
|
private IL10N $l;
|
||||||
|
private IConfig $config;
|
||||||
|
|
||||||
|
public function __construct(IConfig $config, IL10N $l) {
|
||||||
|
$this->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
"extends @nextcloud/browserslist-config"
|
"extends @nextcloud/browserslist-config"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.0.0",
|
"node": ">=20.0.0",
|
||||||
"npm": "^7.0.0 || ^8.0.0"
|
"npm": "^7.0.0 || ^8.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user