chore(docs): sync developer guide

This commit is contained in:
Elian Doran
2025-04-12 01:36:45 +03:00
parent d3e18a68a8
commit cd35884446
37 changed files with 2693 additions and 2697 deletions

View File

@@ -1,7 +1,7 @@
# Check box option
In the TPL:
```html
```
<div class="options-section">
<h4>Background effects</h4>

View File

@@ -1,7 +1,5 @@
# Creating a new option
1. Go to `options_interface.ts` and add the option to `OptionDefinitions`, specifying its intended data type (boolean, string, number). Note that in the end the option will still be stored as a string, but this aids in type safety across the application.
2. To add a new option with a set default, go to `options_init.ts` in the server and add a new entry in the `defaultOptions`.
3. **Make the option adjustable by the client**
By default options are not adjustable or visible to the client. To do so, modify `routes/api/options.ts` to add the newly added option to `ALLOWED_OPTIONS`.

View File

@@ -5,7 +5,7 @@ For example, to create a select:
First, modify the template (`TPL`), to add the new widget:
```plain
```
<div class="col-6">
<label>First day of the week</label>
<select class="first-day-of-week-select form-control">
@@ -17,19 +17,19 @@ First, modify the template (`TPL`), to add the new widget:
Secondly, create a reference to the new element in `doRender()`:
```plain
```
this.$firstDayOfWeek = this.$widget.find(".first-day-of-week-select");
```
Then in `optionsLoaded` adjust the value to the one set in the database:
```plain
```
this.$firstDayOfWeek.val(options.firstDayOfWeek);
```
To actually update the option, add a listener in `doRender`:
```plain
```
this.$firstDayOfWeek.on("change", () => {
this.updateOption("firstDayOfWeek", this.$firstDayOfWeek.val());
});