From d676348d35f586b0a127c3b64ee457147d729eb7 Mon Sep 17 00:00:00 2001 From: axolotle Date: Mon, 23 Oct 2023 16:18:44 +0200 Subject: [PATCH] doc: fix page routes and inconsistencies --- doc/generate_configpanel_doc.py | 6 +++--- doc/generate_options_doc.py | 10 +++++----- src/utils/configpanel.py | 13 +++++-------- src/utils/form.py | 6 +++--- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/doc/generate_configpanel_doc.py b/doc/generate_configpanel_doc.py index 5026c4520..d51ee38a1 100644 --- a/doc/generate_configpanel_doc.py +++ b/doc/generate_configpanel_doc.py @@ -29,10 +29,10 @@ template: docs taxonomy: category: docs routes: - default: '/packaging_apps_config_panels' + default: '/packaging_config_panels' --- -# Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{current_commit}/doc/generate_configpanel_doc.py) on {today} (YunoHost version {version}) +Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{current_commit}/doc/generate_configpanel_doc.py) on {today} (YunoHost version {version}) ## Glossary @@ -52,7 +52,7 @@ You may encounter some named types which are used for simplicity. ``` - `JSExpression`: a `str` JS expression to be evaluated to `true` or `false`: - used for properties: `visible` and `enabled` - - operators availables: `==`, `!=`, `!`, `&&`, `||`, `+`, `-`, `*`, `/`, `%`, `match()` + - operators availables: `==`, `!=`, `>`, `>=`, `<`, `<=`, `!`, `&&`, `||`, `+`, `-`, `*`, `/`, `%` and `match()` - [examples available in the advanced section of Options](/packaging_apps_options#advanced-use-cases) """ ) diff --git a/doc/generate_options_doc.py b/doc/generate_options_doc.py index 356cea3a5..87ba3c295 100644 --- a/doc/generate_options_doc.py +++ b/doc/generate_options_doc.py @@ -29,10 +29,10 @@ template: docs taxonomy: category: docs routes: - default: '/packaging_apps_options' + default: '/dev/forms' --- -# Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{current_commit}/doc/generate_options_doc.py) on {today} (YunoHost version {version}) +Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{current_commit}/doc/generate_options_doc.py) on {today} (YunoHost version {version}) ## Glossary @@ -52,7 +52,7 @@ You may encounter some named types which are used for simplicity. ``` - `JSExpression`: a `str` JS expression to be evaluated to `true` or `false`: - used for properties: `visible` and `enabled` - - operators availables: `==`, `!=`, `!`, `&&`, `||`, `+`, `-`, `*`, `/`, `%`, `match()` + - operators availables: `==`, `!=`, `>`, `>=`, `<`, `<=`, `!`, `&&`, `||`, `+`, `-`, `*`, `/`, `%` and `match()` - [examples available in the advanced section](#advanced-use-cases) - `Binding`: bind a value to a file/property/variable/getter/setter/validator - save the value in `settings.yaml` when not defined @@ -63,13 +63,13 @@ You may encounter some named types which are used for simplicity. - [examples available in the advanced section](#bind) - `Pattern`: a `dict` with a regex to match the value against and an error message ```toml - pattern.regexp = "^[A-F]\d\d$" + pattern.regexp = '^[A-F]\d\d$' pattern.error = "Provide a room like F12: one uppercase and 2 numbers" # or with translated error pattern.error.en = "Provide a room like F12: one uppercase and 2 numbers" pattern.error.fr = "Entrez un numéro de salle comme F12: une lettre majuscule et deux chiffres." ``` - - IMPORTANT: your pattern should be between simple quote, not double. + - IMPORTANT: your `pattern.regexp` should be between simple quote, not double. """ ) diff --git a/src/utils/configpanel.py b/src/utils/configpanel.py index ef0840e2c..5d3972275 100644 --- a/src/utils/configpanel.py +++ b/src/utils/configpanel.py @@ -215,19 +215,16 @@ class PanelModel(ContainerModel): class ConfigPanelModel(BaseModel): """ - Config panels are descriptive format in TOML to bind settings to form items so that a user can alter some of the app's configuration without manually editing files from the command line. + Configuration panels are descriptive format in TOML to bind settings to form items so that a user can alter some of the app's configuration without manually editing files from the command line. - From a packager perspective, this configpanel.toml is coupled to the `scripts/config` script, which may be used to define custom getters/setters. However, most use cases should be covered automagically by the core, thus it may not be necessary to define a scripts/config at all! + From a packager perspective, this `config_panel.toml` is coupled to the `scripts/config` script, which may be used to define custom getters/setters. However, most use cases should be covered automagically by the core, thus it may not be necessary to define a scripts/config at all! - ---------------- - IMPORTANT: In accordance with YunoHost's spirit, please keep things simple and do not overwhelm the admin with tons of misunderstandable or advanced settings. - - ---------------- + ! IMPORTANT: Please: Keep in mind the YunoHost spirit, and try to build your panels in such a way as to expose only really useful parameters, and if there are many of them, to relegate those corresponding to rarer use cases to "Advanced" sub-sections. Config panels are structured as a series of panels (that renders as tabs in the web-admin) that contains a series of sections that contains options. - Options can be directly binded to settings, or captured by custom bash setters/getter, `button` Options can trigger custom bash functions. + Options can be directly binded to settings, or captured by custom bash setters/getter, `button` Options can trigger "actions" (e.g. custom bash functions). - - [Learn more about Options](/packaging_apps_options) in their dedicated doc page as those are also used in app install forms. + - [Learn more about Options](/dev/forms) in their dedicated doc page as those are also used in app install forms. - [Check the basic toml example](https://github.com/YunoHost/example_ynh/blob/master/config_panel.toml.example) and the [basic `scripts/config` example](https://github.com/YunoHost/example_ynh/blob/master/scripts/config) - [Check config panels of other apps](https://grep.app/search?q=version&filter[repo.pattern][0]=YunoHost-Apps&filter[lang][0]=TOML) - [Check `scripts/config` of other apps](https://grep.app/search?q=ynh_app_config_apply&filter[repo.pattern][0]=YunoHost-Apps&filter[lang][0]=Shell) diff --git a/src/utils/form.py b/src/utils/form.py index c17c2502d..cd1138931 100644 --- a/src/utils/form.py +++ b/src/utils/form.py @@ -553,8 +553,8 @@ class ButtonOption(BaseReadonlyOption): - [common properties](#common-option-properties) - `bind`: forced to `"null"` - `style`: any of `"success|info|warning|danger"` (default: `"success"`) - - `enabled`: `Binding` or `bool` (default: `true`) - - when used with `Binding` you can enable/disable the button depending on context + - `enabled`: `JSExpression` or `bool` (default: `true`) + - when used with `JSExpression` you can enable/disable the button depending on context - `icon` (optional): any icon name from [Fork Awesome](https://forkaweso.me/Fork-Awesome/icons/) - Currently only displayed in the web-admin """ @@ -764,7 +764,7 @@ class StringOption(BaseStringOption): [section.my_option_id] type = "string" default = "E10" - pattern.regexp = "^[A-F]\d\d$" + pattern.regexp = '^[A-F]\d\d$' pattern.error = "Provide a room like F12 : one uppercase and 2 numbers" ```