create_document
ID: create_document
This brings up the Create Document wizard that guides the user through the process of creating a new document within a folder. This wizard is aware of the currently viewed folder and the current user and derives its behavior based off of those contexts. Newly created content is created as a child of the current folder.
Sample Code
var UI = require("ui");
var actionContext = {};
UI.startAction(observableHolder, "create_document", actionContext, function(err) {
// if something went wrong, err will contain the error
// otherwise, success
});
Configuration
This action derives some of its behavior from the configuration service.
Content Types
You can control which content types are available for this action by adjusting the content-types
configuration block, like this:
{
"content-types": {
"remove": true,
"items": [{
"key": "my:article",
"title": "My Article"
}, {
"key": "my:pressRelease",'
"title": "My Press Release"
}]
}
}
Suppose, for example, that you have three content types:
- My Article (
my:article
) - My Press Release (
my:pressRelease
) - My News Item (
my:newsItem
)
Suppose you'd like to have a folder named My Articles
that only allows Articles to be created inside of it.
You can achieve this by:
- Setting the type of the folder to
my:articlesFolder
- Setting up the following configuration block:
{
"evaluator": "context-document-has-type",
"condition": "my:articlesFolder",
"config": {
"content-types": {
"remove": true,
"items": [{
"key": "my:article",
"title": "My Article"
}]
}
}
}