From 9d727a211e51b496a5e579b05eaaace010efa9ca Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 20 Apr 2013 20:00:59 +0000 Subject: [PATCH] Complete project module (for now) - Remove unused modules from ``config.json`` * Move config list stuff from ``onLoad`` to ``api`` The api call might be useful elsewhere --- modules/project/pages.js | 2 +- modules/project/project.js | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 1412471..76bbe4b 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -33,7 +33,7 @@ var pages = function(dbot) { } res.render('project', { - "configList": "", // what variable do I put here + "configList": dbot.modules.project.api.configList(), // what variable do I put here "name": dbot.config.name, "intro": dbot.t("dbotintro", { "botname": dbot.config.name diff --git a/modules/project/project.js b/modules/project/project.js index 302b504..ba256e1 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -4,45 +4,44 @@ * the dbot. */ -_ = require('underscore'), - exec = require('child_process').exec; +_ = require('underscore'); var project = function(dbot) { - this.onLoad = function() { - var configList = function(){ + this.api = { + 'configList' : function(callback){ var list = []; if(_.has(dbot.modules,'dent')){ - configList.push(dbot.t("dent-account", { + list.push(dbot.t("dent-account", { "username": dbot.config.dent.username })); } if(dbot.config.dent.dentQuotes) { - configList.push(dbot.t("dent-push")); + list.push(dbot.t("dent-push")); } if(_.has(dbot.modules,'link')){ if(dbot.config.link.autoTitle){ - configList.push(dbot.t("link-autotitle")); + list.push(dbot.t("link-autotitle")); } } if(_.has(dbot.modules,'quotes')){ - configList.push(dbot.t("quote-rmlimit", { + list.push(dbot.t("quote-rmlimit", { "limit": dbot.config.quotes.rmLimit })); } if(_.has(dbot.modules,'report')){ if(dbot.config.report.notifyVoice){ - configList.push(dbot.t("report-notifyvoice")); + list.push(dbot.t("report-notifyvoice")); } } if(_.has(dbot.modules,'web')){ - configList.push(dbot.t("web-port", { + list.push(dbot.t("web-port", { "port": dbot.config.web.webPort })); } return list; - }.bind(this); - }.bind(this); + } + }; } exports.fetch = function(dbot){