# Lemonldap::NG::Manager forms This files contains the form used to expose configuration attributes. The form is chosen by looking at the *type* property of the current data. This property is defined in `Lemonldap::NG::Manager::Build::Attributes` package. By default, it is set to *text*. `Lemonldap::NG::Manager::Build::Attributes` is compiled into JSON/JS files by `jsongenerator.pl`script. ## 1. Form file architecture Form files must be called `.json` where ** is the declared type of configuration property to display. Form files must contain only HTML that will be included in the manager DOM *(in `#form` div)*. It **must** consist of two blocks: * a `
` div that contains the form, * a ` ## 2. Form main div Based on bootstrap CSS, the main div part may look like: If configuration item name is read-only:

{{translate(currentNode)}}

__ FORM INPUTS __
If configuration item name may be modified:

__ FORM INPUTS __
> Note that keywords to translate must be set in all `languages/*.json` files. ### 2.1. AngularJS bindings Some AngularJS variables are available : * `currentNode`: the data subnode corresponding to the selected tree item * `currentScope`: the AngularJS scope corresponding to the selected tree item You can simply used them as follow: ## 3. Script part Form div **must** define which item menu to display. It is done via the script part of the file: Empty context menu: Else: ### 3.1. Menu item #### 3.1.1. Simple case Menu item is a javascript object with at least the key `title`. In this case, the item will be displayed using the translation of *cancel*. It will launch the function `$scope.cancel()` declared in AngularJS controller *(`js/manager.js` file)* without any argument: functions in the controller can access to controller properties and methods. #### 3.1.2. Dropdown item You can have sub items simply using `buttons` key which must then be an array of menu items. #### 3.1.3. Specify function to use Same as below except that it will launch `$scope.addVhost()`. ##### Tips You can access to the parent using this: * `currentScope.$parentNodeScope` for the parent scope * `currentScope.$parentNodeScope.$modelValue` for the parent node #### 3.1.5 Icons The field `icon` can be set to define the Bootstrap glyphicon to use. ## 4. Modal window You can use a modal window to display a choice (look at forms/portalSkin.html for a complete example):