@@ -14,13 +14,16 @@ This is a small Node.JS library for loading Strider extensions.
1414## API
1515
1616```
17- var Loader = require('strider-extension-loader')
18- , loader = new Loader()
17+ var Loader = require('strider-extension-loader');
18+ var loader = new Loader();
1919```
2020
21- ### new Loader(lesspaths)
22- ` lesspaths ` is an optional list of directories that will be made
23- available while compiling plugins' ` less ` style files.
21+ ### new Loader(lesspaths, isNamespaced)
22+ * ` lesspaths ` is an optional list of directories that will be made
23+ available while compiling plugins' ` less ` style files.
24+ * ` isNamespaced ` is for backwards compatibility with older versions
25+ where the default type controllers e.g. ` JobController ` were not namespaced.
26+ For versions < 1.6.0 this property should NOT be set.
2427
2528### .collectExtensions(dirs, done(err))
2629
@@ -30,7 +33,7 @@ Collect all strider extensions found in the given directories.
3033
3134Load the "webapp" portion of all extensions.
3235
33- ` extensions ` looks like ` {plugintype: {pluginid: loadedPlugin, ... }, ...} `
36+ ` extensions ` looks like ` { plugintype: { pluginid: loadedPlugin, ... }, ... } `
3437
3538The structure of the ` loadedPlugin ` object depend on the plugin type.
3639- job:
@@ -42,7 +45,7 @@ Same as `initWebAppExtensions` but for the `worker` portion.
4245### .initTemplates(done(err, templates))
4346
4447Load all of the templates from all extensions. ` templates ` looks like
45- ` {templatename: stringtemplate, ...} ` .
48+ ` { templatename: stringtemplate, ... } ` .
4649
4750### .initStaticDirs(app, done(err))
4851
@@ -64,7 +67,7 @@ Then the js and css are written to the files specified `jspath` and
6467
6568Html for the templates are available on the ` configs ` objects.
6669
67- Configs look like ` {plugintype: {pluginid: config, ...}, ...} ` and
70+ Configs look like ` { plugintype: { pluginid: config, ...}, ... } ` and
6871` config ` looks like:
6972
7073``` js
@@ -86,7 +89,7 @@ package.json.
8689 " title" : " My Plugin" ,
8790 " icon" : " icon.png" , // should be in the ./static dir
8891 " config" : {
89- " controller" : // defaults to "JobController" for job plugins, "ProviderController", etc.
92+ " controller" : // defaults to "Config. JobController" for job plugins, "Config. ProviderController", etc.
9093 " script" : // path where the js should be loaded from. Path defaults to "config/config.js"
9194 " style" : // defaults to "config/config.less"
9295 " template" : // defaults to "config/config.html"
@@ -100,7 +103,7 @@ I hope that's clear.
100103
101104If you don't need to do anything fancy, you can just use the default
102105controller for your plugin type. Take a look in
103- [ strider's public/javascript/pages/ config.js ] ( asd ) for the source of
106+ [ strider's ` client/config/controllers ` directory ] [ config-controllers ] for the source of
104107those controllers. Basically, each controller makes available a
105108` config ` object on the scope, which is populated by the plugin's
106109config for the currently selected branch. Also a ` save() ` function is
@@ -180,7 +183,7 @@ To declare your npm package as a strider plugin, include a
180183 " tplname" : " path/to/tpl.html"
181184 },
182185 " config" : { // project-specific configuration
183- " controller" : // defaults to "JobController" for job plugins, "ProviderController", etc.
186+ " controller" : // defaults to "Config. JobController" for job plugins, "Config. ProviderController", etc.
184187 " script" : // path where the js should be loaded from. Path defaults to "config/config.js"
185188 " style" : // defaults to "config/config.less". Can be less or css
186189 " template" : // defaults to "config/config.html"
@@ -508,28 +511,28 @@ module.exports = function (context, done) {
508511This is what gets passed into the ` basic ` init function, as well as
509512the ` listen ` and ` routes ` functions of various plugin types.
510513
511- - config ; main strider config
512- - emitter ; for passing events
514+ - config -- main strider config
515+ - emitter -- for passing events
513516- models
514517- logger
515518- middleware
516519- auth
517- - app ; the express app
520+ - app -- the express app
518521- registerBlock
519522
520523#### registerBlock(name, cb)
521524
522525``` javascript
523- ctx .registerBlock (' HeaderBrand' , function (context , cb ){
526+ ctx .registerBlock (' HeaderBrand' , function (context , cb ) {
524527 // context has a lot of useful stuff on it:
525528
526- var email = context .currentUser .user .email
529+ var email = context .currentUser .user .email ;
527530
528531 // You can do some async processing here, but bear in mind
529532 // you'll be blocking the page load.
530533
531- cb (null , " <h1>FooStrider</h1>" );
532- })
534+ cb (null , ' <h1>FooStrider</h1>' );
535+ });
533536```
534537
535538#### Templates in strider.json
@@ -541,8 +544,8 @@ strider.json:
541544``` javascript
542545{
543546 " templates" : {
544- " HeaderBrand" : " <h1>An HTML String</h1>" ,
545- " FooterTOS" : " ./path/to/TOS.html"
547+ " HeaderBrand" : " <h1>An HTML String</h1>" ,
548+ " FooterTOS" : " ./path/to/TOS.html"
546549 }
547550}
548551```
@@ -555,3 +558,5 @@ If you want to simply 'append' to a block, use the `registerBlock` method
555558and make sure that you prefix the html you return with:
556559` ctx.content ` which will contain either the default html, or the content from
557560previous extensions.
561+
562+ [ config-controllers ] : https://github.com/Strider-CD/strider/tree/master/client/config/controllers
0 commit comments