lemonldap-ng/lemonldap-ng-manager/site/static/forms
2016-01-13 20:45:28 +00:00
..
authChoice.html Add optional URL in authChoice entries (Closes: #884) 2016-01-11 21:30:06 +00:00
authChoiceContainer.html Add optional URL in authChoice entries (Closes: #884) 2016-01-11 21:30:06 +00:00
authParams.html Little error that breaks dynamic auth modules choice 2015-12-10 20:40:50 +00:00
authParamsText.html Dynamic auth module display for multi 2015-12-15 19:05:45 +00:00
authParamsTextContainer.html Dynamic auth module display for multi 2015-12-15 19:05:45 +00:00
blackWhiteList.html Fix usage of bootstrap panels (#820) 2015-07-09 15:38:35 +00:00
bool.html Define icons for buttons in all forms (#820) 2015-07-23 16:26:37 +00:00
boolOrExpr.html Define icons for buttons in all forms (#820) 2015-07-23 16:26:37 +00:00
catAndAppList.html Work on applications and categories (#820) 2015-07-13 17:01:03 +00:00
file.html First version of "download" button (#878) 2016-01-12 15:24:12 +00:00
grant.html New forms for grantSessionRule 2015-12-30 18:32:01 +00:00
grantContainer.html New forms for grantSessionRule 2015-12-30 18:32:01 +00:00
home.html Ref conf must be latest (Closes: #889) 2016-01-13 20:45:28 +00:00
int.html Work on int form (#820) 2015-07-24 13:34:29 +00:00
keyText.html Work on UI for vhost configuration (#820) 2015-10-23 14:03:46 +00:00
keyTextContainer.html Work on keyTextContainer form (#820) 2015-07-21 06:58:58 +00:00
longtext.html Define icons for buttons in all forms (#820) 2015-07-23 16:26:37 +00:00
menuApp.html Use elem to get portal data in modal (#820) 2015-07-24 08:07:04 +00:00
menuCat.html Work on applications and categories (#820) 2015-07-13 17:01:03 +00:00
oidcOPMetaDataNode.html Work on UI for OpenID Connect (#820) 2015-10-23 15:39:29 +00:00
oidcOPMetaDataNodeContainer.html Work on UI for OpenID Connect (#820) 2015-10-23 15:39:29 +00:00
oidcRPMetaDataNode.html Work on UI for OpenID Connect (#820) 2015-10-23 15:39:29 +00:00
oidcRPMetaDataNodeContainer.html Work on UI for OpenID Connect (#820) 2015-10-23 15:39:29 +00:00
password.html Use table in password component (#820) 2016-01-13 09:59:00 +00:00
portalskin.html Work on portalskin form (#820) 2015-07-21 06:58:57 +00:00
portalskinbackground.html Preview of background image (#820) 2015-07-23 16:49:22 +00:00
post.html Work on UI for vhost configuration (#820) 2015-10-23 14:03:46 +00:00
postContainer.html Work on UI for vhost configuration (#820) 2015-10-23 14:03:46 +00:00
README.md Move files that should be used only by jsongenerator.pl in Manager/Build 2015-12-26 20:08:31 +00:00
restore.html Work on restore form (#820) 2015-07-21 06:58:56 +00:00
RSAKey.html Work on UI for RSA keys (#820) 2015-10-23 14:03:47 +00:00
RSAKeyNoPassword.html Work on UI for RSA keys (#820) 2015-10-23 14:03:47 +00:00
rule.html Work on UI for vhost configuration (#820) 2015-10-23 14:03:46 +00:00
ruleContainer.html New forms for grantSessionRule 2015-12-30 18:32:01 +00:00
samlAssertion.html Work on UI for SAML (#820) 2015-10-23 15:18:47 +00:00
samlAttribute.html Work on UI for SAML (#820) 2015-10-23 15:18:47 +00:00
samlAttributeContainer.html Remove "name" from radio input, managed by Augular (Closes: #882) 2016-01-12 09:44:28 +00:00
samlIDPMetaDataNode.html Work on UI for SAML (#820) 2015-10-23 15:18:47 +00:00
samlIDPMetaDataNodeContainer.html Fix labels in SAML SP/IDP nodes (#820) 2016-01-13 09:59:01 +00:00
samlService.html Work on UI for SAML (#820) 2015-10-23 15:18:47 +00:00
samlSPMetaDataNode.html Work on UI for SAML (#820) 2015-10-23 15:18:47 +00:00
samlSPMetaDataNodeContainer.html Fix labels in SAML SP/IDP nodes (#820) 2016-01-13 09:59:01 +00:00
select.html Define icons for buttons in all forms (#820) 2015-07-23 16:26:37 +00:00
simpleInputContainer.html Allow password in simpleInputContainer (#820) 2016-01-13 09:58:59 +00:00
text.html Adapt text form (#820) 2015-07-13 16:03:42 +00:00
trool.html Remove "name" from radio input, managed by Augular (Closes: #882) 2016-01-12 09:44:28 +00:00
virtualHost.html Work on UI for vhost configuration (#820) 2015-10-23 14:03:46 +00:00
virtualHostContainer.html Work on UI for vhost configuration (#820) 2015-10-23 14:03:46 +00:00
white.html Set files to the right place 2015-05-14 06:44:52 +00:00

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.plscript.

1. Form file architecture

Form files must be called <type>.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 class="panel panel-default"> div that contains the form,
  • a <script type="text/javascript"> script that defines which item to display in context menu.

Basic example:

<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">{{translate(currentNode)}}</h3>
  </div>
  <div class="panel-body">
    <div class="input-group">
      <label class="input-group-addon" for="textinput" trspan="value"/>
      <input id="textinput" class="form-control" ng-model="currentNode.data"/>
    </div>
  </div>
</div>
<script type="text/javascript">
buttons=[{
  "title": "cancel"
}];
</script>

2. Form main div

Based on bootstrap CSS, the main div part may look like:

If configuration item name is read-only:

<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">{{translate(currentNode)}}</h3>
  </div>
  <div class="panel-body">
  __ FORM INPUTS __
  </div>
</div>

If configuration item name may be modified:

<div class="panel panel-default">
  <div class="panel-heading"> <!-- optional -->
    <h3 class="panel-title" trspan="OptionalTitle" />
  </div>
  <div class="panel-body">
  __ FORM INPUTS __
  </div>
</div>

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:

<input class="form-control" ng-model="currentNode.data"/>

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:

<script type="text/javascript">
buttons=[];
</script>

Else:

<script type="text/javascript">
buttons=[
  {<menu item1>},
  {<menu item2>},
  {<menu item3>}
]
</script>

3.1. Menu item

3.1.1. Simple case

Menu item is a javascript object with at least the key title.

<script type="text/javascript">
buttons=[
  { "title": "cancel" }
]
</script>

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.

<script type="text/javascript">
buttons=[{
  "title": "textToTranslate",
  "buttons": [
    { "title": "cancel" },
    { "other": "item" }
  ]
}]
</script>

3.1.3. Specify function to use

<script type="text/javascript">
buttons=[{
  "title": "addVirtualHost",
  "action": "addVhost"
}]
</script>

Same as below except that it will launch $scope.addVhost().

3.1.4. Custom function

<script type="text/javascript">
buttons=[{
  "title": "addVirtualHost",
  "action": function(currentNode,currentScope){
    doSomethingWith(currentNode);
  }
}]
</script>

In this case, the item will launch the defined function with two arguments:

  • currentNode: the data subnode corresponding to the selected tree item
  • currentScope: the AngularJS scope corresponding to the selected tree item
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

<script type="text/javascript">
buttons=[{
  "title": "addVirtualHost",
  "action": "addVhost",
  "icon": "plus-sign",
}]
</script>

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):

<button class="btn btn-info" ng-click="showModal('portalSkinChoice.html')">

A modal window will be displayed using portalSkinChoice.html template. This template must be declared in the file:

<script type="text/ng-template" id="portalSkinChoice.html">
  <div class="modal-header">
    <h3 class="modal-title" trspan="chooseSkin" />
  </div>
  <div class="modal-body">
    <div class="btn-group">
      <button class="btn" ng-repeat="b in currentNode.select" ng-click="ok(currentNode.data=b.k)">
        {{b.v}}
      </button>
    </div>
  </div>
  <div class="modal-footer">
    <button class="btn btn-primary" ng-click="ok()" trspan="ok"></button>
    <button class="btn btn-warning" ng-click="cancel()" trspan="cancel"></button>
  </div>
</script>