Permalink
Browse files

You can display plugins now and access them across the code

  • Loading branch information...
1 parent fa22333 commit 2b348ce7b5b84272d460ad4fe273678615128f6b @fakedarren committed Apr 13, 2013
View
6 app.js
@@ -1,7 +1,7 @@
var express = require('express'),
app = express(),
controller = require('./backend/classes/controller.class'),
- Plugins = require('./backend/classes/plugins.class.js');
+ plugins = require('./backend/classes/plugins.class.js');
app.set('view engine', 'jade');
@@ -15,9 +15,9 @@ app.use(express.session({
}));
-controller.initialize(app);
+global.plugins = plugins.initialize(app);
-new Plugins(app);
+controller.initialize(app);
['/', /^\/[^cms?].*/i].forEach(function(regex){
@@ -4,6 +4,8 @@ var fs = require("fs"),
var Plugins = prime({
+ collection: [],
+
constructor: function(app){
this.app = app;
this.parsePlugins();
@@ -27,10 +29,17 @@ var Plugins = prime({
},
registerPlugin: function(plugin){
+ var config = require(plugin + '/edamame.json');
+ this.collection.push(config);
console.log('\nregistering plugin ' + plugin);
}
});
-module.exports = Plugins;
+module.exports = {
+ initialize: function(app){
+ var plugins = new Plugins(app);
+ return plugins.collection;
+ }
+};
@@ -1,14 +1,16 @@
module.exports = {
routes: {
- 'settings': {
- 'url': '/cms/settings',
+ 'plugins': {
+ 'url': '/cms/settings/plugins',
'method': 'get'
}
},
- settings: function(req, res){
- res.render('backend/settings/settings');
+ plugins: function(req, res){
+ res.render('backend/settings/plugins', {
+ plugins: global.plugins
+ });
}
};
@@ -32,9 +32,13 @@ html(lang="en")
a(href="/cms/library/images") Images
a(href="/cms/library/files") Files
a(href="/cms/library/videos") Videos
- li
- a(href="/cms/settings") Settings
-
+ li.dropdown
+ a.dropdown-toggle(data-toggle="dropdown", href="#") Settings
+ b.caret
+ ul.dropdown-menu
+ li
+ a(href="/cms/settings/plugins") Plugins
+
ul.nav.pull-right
li.dropdown
a.dropdown-toggle(data-toggle="dropdown", href="#") Joe Bloggs
@@ -0,0 +1,25 @@
+extends ../backend-layout
+
+block content
+
+ div.container
+ div.row
+
+ div.span9
+ div.page-header
+ h1 Plugins
+
+ ul.nav.nav-tabs
+ li.active
+ a(href="#tab-plugins", data-toggle="tab") Installed Plugins
+
+ div.tab-content
+ div.tab-pane.active#tab-plugins
+ ul
+ each plugin in plugins
+ li #{plugin.name}
+
+
+ div.span3
+ div.well
+
@@ -1,13 +0,0 @@
-extends ../backend-layout
-
-block content
-
- div.container
- div.row
-
- div.span9
- h1 Settings
-
- div.span3
- div.well
-

0 comments on commit 2b348ce

Please sign in to comment.