adds manifest documentation

This commit is contained in:
perploug
2013-11-14 13:11:20 +01:00
parent 132b1f305a
commit 0a6826c62a

View File

@@ -0,0 +1,170 @@
@ngdoc overview
@name Manifest overview
@description
This is a sample manifest, it is always stored in a folder in /app_plugins, with the name package.manifest:
{
propertyEditors: [
{
alias: "Sir.Trevor",
name: "Sir Trevor",
hideLabel: true,
valueType: "JSON",
editor: {
view: "~/App_Plugins/SirTrevor/SirTrevor.html"
}
}
],
javascript: [
'~/App_Plugins/SirTrevor/SirTrevor.controller.js'
]
}
##Root elements
The manifest can contain 4 root colllections, none of them are mandatory
{
propertyEditors: [],
parameterEditors:[],
javascript: [],
css: []
}
##propertyEditors
Returns an array of editor objects, each object specifies an editor to make available to data types as an editor component. These editors are primarily property editors for content, media and members, but can also be made available as a macro parameter editor.
The basic values on any editor is `alias`, `name`, and `editor` these 3 must be set. Furthermore, the `editor` value is an object with additional configuration options on, but must contain a `view` value.
{
alias: "my.editor.alias",
name: "My friendly editor name",
editor: {
view: "~/App_Plugins/SirTrevor/view.html"
},
prevalues:{
fields: []
}
}
- **alias** The alias of the editor, this must be unique, its recommended to prefix with your own "namespace"
- **name** the name visible to the user in the ui, should also be unique.
- **editor** object containing editor configuration (see below)
- **isParameterEditor** enables the property editor as a macro parameter editor can be true/false
- **prevalues** configuration of editor prevalues (see below)
- **defaultConfig** default configation values (see below)
###Editor
Besides setting a view, the editor can also contain additinal information.
editor: {
view: "~/App_Plugins/SirTrevor/view.html",
hideLabel: true,
valueType: "TEXT",
validation: {},
isReadOnly: false
}
- **view**:path to the html file to use for rendering the editor
- **hideLabel**: turn the label on/off
- **valueType**: sets the DB type the value is stored as, by default its string
- **validation**: object describing required validators on the editor
- **isReadOnly**: disables editing the value
####valueType
Sets what kind of data the editor will save in the database. by default this is set to "string".
editor: {
view: "~/App_Plugins/SirTrevor/view.html",
valueType: "TEXT"
}
**The available options are**
- **STRING** : stores the value as an nvarchar in the database
- **DATETIME**: stores the value as datetime in the database
- **TEXT**: stores the value as ntext in the database
- **INT** stores the value as a bigint in the database
- **JSON** stored as ntext, but automatically serialized to dynamic object
###prevalues
Collection of prevalue editors, used for configurating the property editor, the prevalues object must return an array of editors, called "fields".
prevalues: {
fields:[
{
label: "Enable something",
description: "This is a describtion",
key: "enableStuff",
view: "boolean"
}
]
}
Each field contains a number of configuration values:
- **label**: the label shown on the data type configuration screen
- **description**: help text displayed underneath the label
- **key**: the key the prevalue is stored under (see below)
- **view**: path to the editor used to configure this prevalue (see below)
####key
The key on a prevalue, determines where its stored in the database, so if you give your prevalue the key "wolf" - then this key will be used in the prevalue table.
But it also means that when this property editor is used on a propety, then this prevalue will be exposed on the models configuration object like below, inside the property editors controller:
//this is the property value
$scope.model.value = "hello";
///this is the configration on the property editor:
$scope.model.config
//this is our specific prevalue with the alias wolf
$scope.model.config.wolf
####view
The `view` config value points the prevalue editor to an editor to use. This follows the same concept as any other editor in umbraco, but with prevalue editors there are a couple of conventions.
If you just specify a name like "boolean" then umbraco will look at `/umbraco/views/prevalueeditors/boolean/boolean.html` for the editor view - if you wish to use your own, you specify the path like `~/app_data/package/prevalue-editor.html`.
###defaultConfig
The defaultConfig object, provides a collection of default configuration values, in cases the property editor is not configured or is used a parameter editor, which doesnt allow configuration. The object is a key/value collection and must match the prevalue fields keys.
defaultConfig: {
wolf: "nope",
editor: "hello",
random: 1234
}
##parameterEditors
Returns an array of editor objects, each object specifies an editor to make available to macro parameters as an editor component. These editors work solely as parameter editors, and will not show up on the property editors list.
The parameter editors array follows the same format as the property editors described above, however, it cannot contain prevalues since there are no configuration options for macro parameter editors.
##javascript
Returns a string[] of javascript files to load on application start
javascript: [
'~/App_Plugins/SirTrevor/SirTrevor.controller.js',
'~/App_Plugins/SirTrevor/service.js'
]
##css
Returns a string[] of css files to load on application start
css: [
'~/App_Plugins/SirTrevor/SirTrevor.css',
'~/App_Plugins/SirTrevor/hibba.css'
]