3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-26 04:32:37 +01:00

Merge pull request #393 from zuzak/gs2

Improve project module some more
This commit is contained in:
Sam Nicholls 2013-04-20 13:35:45 -07:00
commit 8e3b153f98
5 changed files with 119 additions and 33 deletions

View File

@ -1,21 +1,27 @@
var exec = require('child_process').exec, var exec = require('child_process').exec,
request = require('request'); request = require('request'),
_ = require('underscore');
var pages = function(dbot) { var pages = function(dbot) {
var quoteCat = dbot.db.quoteArrs[dbot.config.name], var quoteCat = dbot.db.quoteArrs[dbot.config.name],
rev, diff; rev, diff, branch;
exec("git rev-list --all | wc -l", function(a, b, c) { exec("git rev-list --all | wc -l", function(error, stdout, stderr) {
rev = b rev = stdout
}); });
exec("git log -1", function(a, b, c) {
diff = b exec("git rev-parse --abbrev-ref HEAD", function(error, stdout, stderr) {
branch = stdout
});
exec("git log -1", function(error, stdout, stderr) {
diff = stdout
}); });
/* TODO: merge back into github module */ /* TODO: merge back into github module */
var milestones; var milestones;
request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(e, r, b){ request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(error, response, body){
milestones = JSON.parse(b); milestones = JSON.parse(body);
}); });
@ -27,11 +33,16 @@ var pages = function(dbot) {
} }
res.render('project', { res.render('project', {
"configList": dbot.modules.project.api.configList(), // what variable do I put here
"name": dbot.config.name, "name": dbot.config.name,
"intro": dbot.t("dbotintro", { "intro": dbot.t("dbotintro", {
"botname": dbot.config.name "botname": dbot.config.name
}), }),
"curr839": dbot.config.language, "curr839": dbot.config.language,
"repo": dbot.config.github.defaultrepo,
"branch": dbot.t("branch",{
"branch": branch
}),
"currver": dbot.config.version, "currver": dbot.config.version,
"currlang": dbot.t("dbotspeaks",{ "currlang": dbot.t("dbotspeaks",{
"lang839": dbot.config.language, "lang839": dbot.config.language,
@ -42,8 +53,7 @@ var pages = function(dbot) {
"projectstatus": dbot.t("projectstatus"), "projectstatus": dbot.t("projectstatus"),
"revnum": dbot.t("revnum",{ "revnum": dbot.t("revnum",{
"name": dbot.config.name, "name": dbot.config.name,
"rev": rev, "rev": rev
"ver": "abcdef" // TODO, obviously
}), }),
"modules": dbot.config.moduleNames, "modules": dbot.config.moduleNames,
"loadmod": dbot.t("loadedmodules"), "loadmod": dbot.t("loadedmodules"),
@ -59,7 +69,10 @@ var pages = function(dbot) {
"diff": diff, "diff": diff,
"pagetitle": dbot.t("pagetitle", { "pagetitle": dbot.t("pagetitle", {
"botname": dbot.config.name "botname": dbot.config.name
}) }),
"git": dbot.t("git"),
"milestonehead": dbot.t("milestones"),
"propaganda": dbot.t("propaganda")
}); });
}, },
}; };

View File

@ -4,10 +4,46 @@
* the dbot. * the dbot.
*/ */
_ = require('underscore');
var project = function(dbot) { var project = function(dbot) {
// Nothing to see here go away love zuzak
this.api = {
'configList' : function(callback){
var list = [];
if(_.has(dbot.modules,'dent')){
list.push(dbot.t("dent-account", {
"username": dbot.config.dent.username
}));
}
if(dbot.config.dent.dentQuotes) {
list.push(dbot.t("dent-push"));
}
if(_.has(dbot.modules,'link')){
if(dbot.config.link.autoTitle){
list.push(dbot.t("link-autotitle"));
}
}
if(_.has(dbot.modules,'quotes')){
list.push(dbot.t("quote-rmlimit", {
"limit": dbot.config.quotes.rmLimit
}));
}
if(_.has(dbot.modules,'report')){
if(dbot.config.report.notifyVoice){
list.push(dbot.t("report-notifyvoice"));
}
}
if(_.has(dbot.modules,'web')){
list.push(dbot.t("web-port", {
"port": dbot.config.web.webPort
}));
}
return list;
}
};
} }
exports.fetch = function(dbot) { exports.fetch = function(dbot){
return new project(dbot); return new project(dbot);
} }

View File

@ -66,6 +66,9 @@
"it": "spagnolo", "it": "spagnolo",
"nl": "Spaans" "nl": "Spaans"
}, },
"nl": {
"en": "Dutch"
},
"revnum": { "revnum": {
"en": "{name} is at revision {rev}", "en": "{name} is at revision {rev}",
"fr": "{name} est à révision {rev}", "fr": "{name} est à révision {rev}",
@ -100,6 +103,9 @@
"it": "debug spento", "it": "debug spento",
"nl": "Debug uitgeschakeld" "nl": "Debug uitgeschakeld"
}, },
"milestones": {
"en": "Milestones"
},
"milestoneprog": { "milestoneprog": {
"en": "Progress", "en": "Progress",
"fr": "Progression", "fr": "Progression",
@ -134,5 +140,29 @@
"de": "Entwicklung", "de": "Entwicklung",
"it": "Sviluppo", "it": "Sviluppo",
"nl": "Ontwikkeling" "nl": "Ontwikkeling"
},
"dent-account": {
"en": "Submitting dents to @{username}"
},
"dent-push": {
"en": "Pushing quotes to identi.ca"
},
"quote-rmlimit": {
"en": "Quote removal throttle set to {limit}"
},
"report-notifyvoice": {
"en": "Voiced users are being notified of reports"
},
"web-port": {
"en": "Web is listening on {port}"
},
"propaganda": {
"en": "Contribute to the code on Github!"
},
"branch": {
"en": "{branch}"
},
"git": {
"en": "version control"
} }
} }

View File

@ -31,11 +31,15 @@ div.progress.open {
div.progress { div.progress {
margin-top:auto; margin-top:auto;
margin-bottom:auto; margin-bottom:auto;
text-align:left;
font-size:50%;
color:gray;
} }
div.progress-inner.open { div.progress-inner.open {
width:20%;
background-color: #3fff3f; background-color: #3fff3f;
background-image: linear-gradient(to bottom,#3fff3f,#7fff7f); background-image: linear-gradient(to bottom,#3fff3f,#7fff7f);
float:left;
margin-right:2px;
} }
div.progress.closed { div.progress.closed {
background-color: #fff5f5; background-color: #fff5f5;
@ -44,7 +48,6 @@ div.progress.closed {
div.progress-inner.closed { div.progress-inner.closed {
background-color: #ff3f3f; background-color: #ff3f3f;
background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f); background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f);
width:20%;
} }
#config { #config {
@ -52,6 +55,11 @@ div.progress-inner.closed {
text-transform:lowercase; text-transform:lowercase;
} }
ul {
text-align:center;
margin-left:0;
margin-bottom:5px;
}
li { li {
background-image: linear-gradient(to bottom, #f5ebe2, #f5e6d8); background-image: linear-gradient(to bottom, #f5ebe2, #f5e6d8);
border:1px solid #f5dcc5; border:1px solid #f5dcc5;

View File

@ -8,12 +8,6 @@ html(lang='#{curr839}')
link(rel='stylesheet', type='text/css', href='/styles.css') link(rel='stylesheet', type='text/css', href='/styles.css')
link(rel="stylesheet", href="/project.css") link(rel="stylesheet", href="/project.css")
title #{pagetitle} title #{pagetitle}
- var mstone = "milestone"
style(type="text/css")
each milestone in milestones
- current = mstone+milestone.number
- wdth = ((milestone.open_issues/(milestone.open_issues + milestone.closed_issues))*100)
.current { width: wdth% }
body body
div.container div.container
div#page div#page
@ -21,13 +15,16 @@ html(lang='#{curr839}')
div.container#main div.container#main
p.intro p.intro
#{dquote} #{dquote}
section#git section#development
h3 #{development} h3 #{development}
h4 #{git}
p.center p.center
#{revnum} #{revnum}
ul
li #{branch}
pre#gitdiff pre#gitdiff
#{diff} #{diff}
h4 #{milestoneprog} h4 #{milestonehead}
table#milestones.center table#milestones.center
tr tr
th #{milestonename} th #{milestonename}
@ -35,25 +32,27 @@ html(lang='#{curr839}')
th #{openmilestone} th #{openmilestone}
th #{closedmilestone} th #{closedmilestone}
each milestone in milestones each milestone in milestones
- var mstone = "milestone" - var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
- var wd = "width:" tr(id="milestone"+milestone.number)
- var pc = "%"
- var wdth = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
tr(id=mstone+milestone.number)
td td
a(href=milestone.url) a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number)
#{milestone.title} #{milestone.title}
td td
div.progress(class=milestone.state) div.progress(class=milestone.state)
div.progress-inner(style=wd+wdth+pc)(class=milestone.state) div.progress-inner(style="width:"+width+"%")(class=milestone.state)
   
print #{Math.round(width)+"%"}
td #{milestone.open_issues} td #{milestone.open_issues}
td #{milestone.closed_issues} td #{milestone.closed_issues}
p.center
a(href="https://github.com/"+repo) #{propaganda}
section#config section#config
h3 #{config} h3 #{config}
ul ul
li #{currlang} li #{currlang}
li #{debugmode} li #{debugmode}
each message in configList
li #{message}
h4 #{loadmod} h4 #{loadmod}
ul#modules ul#modules
each module in modules each module in modules