Skip to content
Snippets Groups Projects
Verified Commit 7af8fe4c authored by Timm Fitschen's avatar Timm Fitschen
Browse files

DOC: update doc for module installation

parent 0e006484
No related branches found
No related tags found
2 merge requests!50Release v0.4.1,!49DOC: update doc for module installation
Pipeline #15617 passed
......@@ -100,14 +100,41 @@ var form_elements = new function () {
this.version = "0.1";
this.dependencies = ["log", "caosdb_utils", "markdown", "bootstrap"];
this.logger = log.getLogger("form_elements");
/**
* Event. On form cancel.
*/
this.cancel_form_event = new Event("caosdb.form.cancel");
/**
* Event. On form submit.
*/
this.submit_form_event = new Event("caosdb.form.submit");
/**
* Event. On field change.
*/
this.field_changed_event = new Event("caosdb.field.changed");
/**
* Event. On field enabled.
*/
this.field_enabled_event = new Event("caosdb.field.enabled");
/**
* Event. On field disabled.
*/
this.field_disabled_event = new Event("caosdb.field.disabled");
/**
* Event. On field ready (e.g. for reference drop downs)
*/
this.field_ready_event = new Event("caosdb.field.ready");
/**
* Event. On field error (e.g. for reference drop downs)
*/
this.field_error_event = new Event("caosdb.field.error");
/**
* Event. Form submitted successfully.
*/
this.form_success_event = new Event("caosdb.form.success");
/**
* Event. Error after form was submitted.
*/
this.form_error_event = new Event("caosdb.form.error");
......@@ -1266,7 +1293,10 @@ var form_elements = new function () {
}, config.to);
const from_input = this.make_form_field(from_config);
$(from_input).toggleClass("form-control", false);
const to_input = this.make_form_field(to_config);
$(to_input).toggleClass("form-control", false);
const ret = $(this._make_field_wrapper(config.name));
if (config.label) {
......@@ -1277,12 +1307,8 @@ var form_elements = new function () {
ret.append(to_input);
// styling
$(from_input).toggleClass("form-control", false);
$(from_input).find(".col-sm-3").toggleClass("col-sm-3", false).toggleClass("col-sm-1");
$(from_input).find(".col-sm-9").toggleClass("col-sm-9", false).toggleClass("col-sm-3");
$(to_input).toggleClass("form-control", false);
$(to_input).find(".col-sm-3").toggleClass("col-sm-3", false).toggleClass("col-sm-1").toggleClass("col-sm-offset-1");
$(to_input).find(".col-sm-9").toggleClass("col-sm-9", false).toggleClass("col-sm-3");
$(from_input).toggleClass("col-sm-4", true);
$(to_input).toggleClass("col-sm-4", true);
return ret[0];
}
......
......@@ -4,7 +4,14 @@ The CaosDB WebUI is organized in modules which can easily be added and on a modu
There are a few steps necessary to create a new module.
## Create the module file
Create a new file in `src/core/js` starting with `ext_`. E.g. `ext_flight_preview.js`. This file should define one function that wraps every thing and which is enabled at the bottom of the file:
Create a new file for each new module. We have the convention, that extensions
which are optional and should stay that way and also custom extensions for
special purposes to name the file starting with `ext_`. E.g.
`ext_flight_preview.js`.
This file should define one function that wraps every thing and which is
enabled at the bottom of the file:
```js
/*
......@@ -51,18 +58,35 @@ $(document).ready(function() {
});
```
## Place Module in Load Order
Add the name of your module file to `build.properties.d/00_default.properties`, where the order is defined in which modules are loaded.
## Install the module
The new new file should be placed in `src/core/js` if it is intended to be merged into the main repository eventually. For development purposes and for custom extensions which are not to be published you may place it in `src/ext/js`.
Everything inside `src/core/js` and `src/ext/js` will eventually being loaded.
So, if there are no other modules which depend on this particular new module,
you are done.
Otherwise, when we need to configure the order in which the
module is being loaded.
### Dependency order
#### For Upstream Code
For modules which are about to be merged into the main or dev branch of this
repository, add the module's file to `build.properties.d/00_default.properties`
at the right location in the list of module files (Array
`MODULE_DEPENDENCIES`). The list defines the order in which module files are
being loaded.
## Add to index.html in test
If you have unittests (and you should), you need to add a line in :
`test/core/index.html`.
#### For Custom Extensions
## Dependency order
Add the module to `build.properties.d/00_default.properties` at the right
location in the list of modules. The list defines the order in which modules are
loaded
For modules which will not be published and merged with the main repository you
may append all your module files in the desired order to the
`MODULE_DEPENDENCIES` array in a new `*.properties` file (e.g.
`build.properties.d/99_local_stuff`):
## Update the changelog
MODULE_DEPENDENCIES+=(libA.js libB.js ext_flight_preview.js)
## Create a merge request
In this example, `libA.js`, `libB.js` and `ext_flight_preview.js` are custom modules developed for this particular CaosDB webui instance.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment