This repository holds the code for the configuration forms used in Open SDG. It also hosts the built JavaScript files which are used by Open SDG.
These forms use the excellent JSONForms open-source library.
- Node.js
To build the project:
npm install
npm run build
Include the built JavaScript files on your page. Open SDG uses the Github-hosted files like so:
<script src="https://open-sdg.org/open-sdg-config-form/bundle.js"></script>
This code expects a certain JavaScript object to exist. Here is a rundown of what it is expecting:
var opensdg = opensdg || {};
opensdg.configForm = {
schema: null, // The JSONSchema for the form
uiSchema: null, // The UI Schema according to JSONForms
initialData: null, // Existing data to populate the form
configFilename: null, // The name of file that will be generated by the form
configFolder: null, // The path to the folder in a target repository that the file will be uploaded to
githubClientId: null, // ClientID if using a direct connection to Github
githubProxyUrl: null, // Proxy URL if using a direct connection to Github
githubRepo: null, // The name of the Github repo that the file will be uploaded to
githubOwner: null, // The owner (organization) of the Github repo that the file will be uploaded to
repositoryLink: null, // The full link to the repository that the file will be uploaded to
};