24 | | == Creating the Plugin definition file == |
25 | | TODO |
| 25 | == Creating the Plugin configuration file == |
| 26 | Every plugin requires a configuration file, which is used to register the views of the plugin with their associated controllers. The configuration file is also used to dynamicly build the sidebar menu. The name of the plugin configuration file has to be `{pluginname}.js`. |
| 27 | |
| 28 | The following template can be used to create a new configuration file: |
| 29 | {{{ |
| 30 | #!javascript |
| 31 | var appPluginNamePlugin = app.registerPlugin('pluginname'); |
| 32 | (function () { |
| 33 | var plugin = appPluginNamePlugin; |
| 34 | plugin.dependencies = ['ngResource']; |
| 35 | plugin.files = []; |
| 36 | plugin.view = ''; |
| 37 | plugin.controller = ''; |
| 38 | plugin.routes = []; |
| 39 | |
| 40 | var menu = app.getMenu(); |
| 41 | var section = menu.getSection('Menu', 1); |
| 42 | section.addEntry({ |
| 43 | name: 'Pluginname', |
| 44 | route: '#/pluginname' |
| 45 | }); |
| 46 | })(); |
| 47 | }}} |
| 48 | |
| 49 | * `plugin.dependencies` specifies the required AngularJS modules |
| 50 | * `plugin.files` specifies the files that will be dynamicly loaded when a view of the plugin is accessed |
| 51 | * `plugin.view` is the main view of the plugin |
| 52 | * `plugin.controller` is the controller of the main view |
| 53 | * `plugin.routes` is used to register new routes (e.g. more than one view) |
| 54 | * `app.getMenu()` is used to add an entry in the sidebar menu |
| 55 | |
| 56 | The `view` and `controller` properties are required all other properties are optional. |