alpacajs

by yccu

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.3.0/handlebars.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//code.cloudcms.com/alpaca/1.5.2/bootstrap/alpaca.min.css">
<script src="//code.cloudcms.com/alpaca/1.5.2/bootstrap/alpaca.min.js"></script>
<div id="field1"></div>

JavaScript

$("#field1").alpaca({
  "optionsSource": {
    "fields": {
      "title": {
        "label": "Strategy Name"
      },
      "description": {
        "label": "Description"
      },
      "bookmarks": {
        "toolbarSticky": true,
        "fields": {
          "item": {
            "fields": {
              "title": {
                "label": "Bookmark Title"
              },
              "url": {
                "type": "url",
                "label": "Bookmark URL"
              }
            }
          }
        }
      },
      "bookmarks2": {
        "toolbarSticky": true,
        "fields": {
          "item": {
            "fields": {
              "title": {
                "label": "Bookmark Title"
              },
              "url": {
                "type": "url",
                "label": "Bookmark URL"
              }
            }
          }
        }
      }
    }
  },
  "schemaSource": {
  	"title":"New Strategy",
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      
      "bookmarks": {
      "title":"Applies to",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "title": {
              "type": "string"
            },
            "url": {
              "type": "string"
            }
          }
        }
      },
      "bookmarks2": {
      	"title":"Condition",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "title": {
              "type": "string"
            },
            "url": {
              "type": "string"
            }
          }
        }
      }
    }
  }
});