From fee7fedbf7de51b116032282369cbd6382b7dbfb Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 30 Jun 2013 15:40:47 +0000 Subject: [PATCH] fix the project quotes thing --- modules/project/pages.js | 116 +++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 59 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index a713f8a..529d634 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -3,8 +3,7 @@ var exec = require('child_process').exec, _ = require('underscore'); var pages = function(dbot) { - var quoteCat = dbot.db.quoteArrs[dbot.config.name], - rev, diff, branch, credit, authors = []; + var rev, diff, branch, credit, authors = []; exec("git log --format='%cN¬' | sort -u | tr -d '\n'", function (error, stdout, sderr) { var credit = stdout.split("¬"); // nobody uses ¬, do they? for (var i = 0; i < credit.length; i++) { @@ -37,65 +36,64 @@ var pages = function(dbot) { return { '/project': function(req, res) { - var quote = dbot.config.name; - if(quoteCat) { - quote = quoteCat[Math.floor(Math.random()*quoteCat.length)]; - } + dbot.api.quotes.getQuote(dbot.config.name, function(quote) { + if(!quote) quote = dbot.config.name; - res.render('project', { - "translation": dbot.modules.project.api.translationProgress(), - "configList": dbot.modules.project.api.configList(), - "authors": authors, - "credits": dbot.t("credits"), - "thanks": dbot.t("thanks"), - "name": dbot.config.name, - "intro": dbot.t("dbotintro", { - "botname": dbot.config.name - }), - "curr839": dbot.config.language, - "repo": dbot.config.modules.github.defaultrepo, - "branch": dbot.t("branch",{ - "branch": branch - }), - "currver": dbot.config.version, - "currlang": dbot.t("dbotspeaks",{ - "lang839": dbot.config.language, - "langen": dbot.strings[dbot.config.language]["en"], - "lang": dbot.t(dbot.config.language), - "name": dbot.config.name - }), - "projectstatus": dbot.t("projectstatus"), - "revnum": dbot.t("revnum",{ + res.render('project', { + "translation": dbot.modules.project.api.translationProgress(), + "configList": dbot.modules.project.api.configList(), + "authors": authors, + "credits": dbot.t("credits"), + "thanks": dbot.t("thanks"), "name": dbot.config.name, - "rev": rev - }), - "modules": dbot.config.moduleNames, - "loadmod": dbot.t("loadedmodules"), - "debugmode": dbot.t("debugmode-" + dbot.config.debugMode), - "milestones": milestones, - "milestoneprog": dbot.t("milestoneprog"), - "config": dbot.t("configoptions"), - "milestonename": dbot.t("milestonename"), - "openmilestone": dbot.t("openmilestone"), - "closedmilestone": dbot.t("closedmilestone"), - "development": dbot.t("development"), - "dquote": quote, - "diff": diff, - "pagetitle": dbot.t("pagetitle", { - "botname": dbot.config.name - }), - "git": dbot.t("git"), - "milestonehead": dbot.t("milestones"), - "propaganda": dbot.t("propaganda"), - "languagecurr": dbot.t(dbot.config.language), - "languagenati": dbot.t("langhead-native"), - "languageeng": dbot.t("en"), - "languageprog": dbot.t("langhead-progress"), - "languagetrans": dbot.t("langhead-translations"), - "languagetranshead": dbot.t("translations"), - "pullreqs": dbot.t("outstanding-pullreq") - }); - }, + "intro": dbot.t("dbotintro", { + "botname": dbot.config.name + }), + "curr839": dbot.config.language, + "repo": dbot.config.modules.github.defaultrepo, + "branch": dbot.t("branch",{ + "branch": branch + }), + "currver": dbot.config.version, + "currlang": dbot.t("dbotspeaks",{ + "lang839": dbot.config.language, + "langen": dbot.strings[dbot.config.language]["en"], + "lang": dbot.t(dbot.config.language), + "name": dbot.config.name + }), + "projectstatus": dbot.t("projectstatus"), + "revnum": dbot.t("revnum",{ + "name": dbot.config.name, + "rev": rev + }), + "modules": dbot.config.moduleNames, + "loadmod": dbot.t("loadedmodules"), + "debugmode": dbot.t("debugmode-" + dbot.config.debugMode), + "milestones": milestones, + "milestoneprog": dbot.t("milestoneprog"), + "config": dbot.t("configoptions"), + "milestonename": dbot.t("milestonename"), + "openmilestone": dbot.t("openmilestone"), + "closedmilestone": dbot.t("closedmilestone"), + "development": dbot.t("development"), + "dquote": quote, + "diff": diff, + "pagetitle": dbot.t("pagetitle", { + "botname": dbot.config.name + }), + "git": dbot.t("git"), + "milestonehead": dbot.t("milestones"), + "propaganda": dbot.t("propaganda"), + "languagecurr": dbot.t(dbot.config.language), + "languagenati": dbot.t("langhead-native"), + "languageeng": dbot.t("en"), + "languageprog": dbot.t("langhead-progress"), + "languagetrans": dbot.t("langhead-translations"), + "languagetranshead": dbot.t("translations"), + "pullreqs": dbot.t("outstanding-pullreq") + }); + }); + } }; };