mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
Docs fixes
- fix error if _data dir exists - add _data dir to cleaning - add some more to widget creation doc
This commit is contained in:
parent
cca1b3e58b
commit
d0cb94b6c7
@ -25,7 +25,10 @@ const allComponents = getAllComponents();
|
||||
let hasBuiltSearchIndex = false;
|
||||
|
||||
// Write component data to file, 11ty will pick it up and create pages - the name & location are important
|
||||
fs.mkdirSync("_data");
|
||||
if (!fs.existsSync("_data"))
|
||||
{
|
||||
fs.mkdirSync("_data");
|
||||
}
|
||||
fs.writeFileSync("_data/components.json", JSON.stringify(allComponents));
|
||||
|
||||
// Put it here too, since addPassthroughCopy() ignores it
|
||||
|
@ -24,16 +24,22 @@ in `test/`.
|
||||
### Get it loaded
|
||||
|
||||
To have EGroupware load your component, it must be included somewhere.
|
||||
Add your component to the `include` block at the top of `/api/js/etemplate/etemplate2.js`. If you have an application
|
||||
Add your component to the `import` block at the top of `/api/js/etemplate/etemplate2.js`. If you have an application
|
||||
specific component, include at the top of your `app.js`.
|
||||
|
||||
```typescript
|
||||
...
|
||||
import './MyWidget/MyWidget.ts';
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
### Load and return
|
||||
|
||||
Components do not need to have a value, but if they do you need to extend Et2InputWidget instead of just Et2Widget.
|
||||
We use `set_value()` the _initial_ load from the template. When the etemplate is submitted, we'll
|
||||
return `widget.getValue()`.
|
||||
`widget.value` is the normal way to access the widget's value programmatically, the other methods add some additional
|
||||
checking.
|
||||
If the widget is readonly or disabled, it won't return value and `widget.value` is not called when submitting.
|
||||
|
||||
### AJAX data
|
||||
|
@ -26,7 +26,7 @@ const execPromise = util.promisify(exec);
|
||||
let childProcess;
|
||||
let buildResults;
|
||||
|
||||
const bundleDirectories = [outdir];
|
||||
const bundleDirectories = [outdir, 'doc/etemplate2/_data'];
|
||||
let packageData = JSON.parse(readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8'));
|
||||
const egwVersion = JSON.stringify(packageData.version.toString());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user