mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 20:22:39 +01:00
Merge pull request #393 from zuzak/gs2
Improve project module some more
This commit is contained in:
commit
8e3b153f98
@ -1,21 +1,27 @@
|
||||
var exec = require('child_process').exec,
|
||||
request = require('request');
|
||||
request = require('request'),
|
||||
_ = require('underscore');
|
||||
|
||||
var pages = function(dbot) {
|
||||
var quoteCat = dbot.db.quoteArrs[dbot.config.name],
|
||||
rev, diff;
|
||||
rev, diff, branch;
|
||||
|
||||
exec("git rev-list --all | wc -l", function(a, b, c) {
|
||||
rev = b
|
||||
exec("git rev-list --all | wc -l", function(error, stdout, stderr) {
|
||||
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 */
|
||||
var milestones;
|
||||
request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(e, r, b){
|
||||
milestones = JSON.parse(b);
|
||||
request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(error, response, body){
|
||||
milestones = JSON.parse(body);
|
||||
});
|
||||
|
||||
|
||||
@ -27,11 +33,16 @@ var pages = function(dbot) {
|
||||
}
|
||||
|
||||
res.render('project', {
|
||||
"configList": dbot.modules.project.api.configList(), // what variable do I put here
|
||||
"name": dbot.config.name,
|
||||
"intro": dbot.t("dbotintro", {
|
||||
"botname": dbot.config.name
|
||||
}),
|
||||
"curr839": dbot.config.language,
|
||||
"repo": dbot.config.github.defaultrepo,
|
||||
"branch": dbot.t("branch",{
|
||||
"branch": branch
|
||||
}),
|
||||
"currver": dbot.config.version,
|
||||
"currlang": dbot.t("dbotspeaks",{
|
||||
"lang839": dbot.config.language,
|
||||
@ -42,8 +53,7 @@ var pages = function(dbot) {
|
||||
"projectstatus": dbot.t("projectstatus"),
|
||||
"revnum": dbot.t("revnum",{
|
||||
"name": dbot.config.name,
|
||||
"rev": rev,
|
||||
"ver": "abcdef" // TODO, obviously
|
||||
"rev": rev
|
||||
}),
|
||||
"modules": dbot.config.moduleNames,
|
||||
"loadmod": dbot.t("loadedmodules"),
|
||||
@ -59,7 +69,10 @@ var pages = function(dbot) {
|
||||
"diff": diff,
|
||||
"pagetitle": dbot.t("pagetitle", {
|
||||
"botname": dbot.config.name
|
||||
})
|
||||
}),
|
||||
"git": dbot.t("git"),
|
||||
"milestonehead": dbot.t("milestones"),
|
||||
"propaganda": dbot.t("propaganda")
|
||||
});
|
||||
},
|
||||
};
|
||||
|
@ -4,10 +4,46 @@
|
||||
* the dbot.
|
||||
*/
|
||||
|
||||
var project = function(dbot) {
|
||||
// Nothing to see here go away love zuzak
|
||||
}
|
||||
_ = require('underscore');
|
||||
|
||||
exports.fetch = function(dbot) {
|
||||
var project = function(dbot) {
|
||||
|
||||
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){
|
||||
return new project(dbot);
|
||||
}
|
||||
|
@ -66,6 +66,9 @@
|
||||
"it": "spagnolo",
|
||||
"nl": "Spaans"
|
||||
},
|
||||
"nl": {
|
||||
"en": "Dutch"
|
||||
},
|
||||
"revnum": {
|
||||
"en": "{name} is at revision {rev}",
|
||||
"fr": "{name} est à révision {rev}",
|
||||
@ -100,6 +103,9 @@
|
||||
"it": "debug spento",
|
||||
"nl": "Debug uitgeschakeld"
|
||||
},
|
||||
"milestones": {
|
||||
"en": "Milestones"
|
||||
},
|
||||
"milestoneprog": {
|
||||
"en": "Progress",
|
||||
"fr": "Progression",
|
||||
@ -134,5 +140,29 @@
|
||||
"de": "Entwicklung",
|
||||
"it": "Sviluppo",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
@ -31,11 +31,15 @@ div.progress.open {
|
||||
div.progress {
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
text-align:left;
|
||||
font-size:50%;
|
||||
color:gray;
|
||||
}
|
||||
div.progress-inner.open {
|
||||
width:20%;
|
||||
background-color: #3fff3f;
|
||||
background-image: linear-gradient(to bottom,#3fff3f,#7fff7f);
|
||||
float:left;
|
||||
margin-right:2px;
|
||||
}
|
||||
div.progress.closed {
|
||||
background-color: #fff5f5;
|
||||
@ -44,7 +48,6 @@ div.progress.closed {
|
||||
div.progress-inner.closed {
|
||||
background-color: #ff3f3f;
|
||||
background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f);
|
||||
width:20%;
|
||||
}
|
||||
|
||||
#config {
|
||||
@ -52,6 +55,11 @@ div.progress-inner.closed {
|
||||
text-transform:lowercase;
|
||||
}
|
||||
|
||||
ul {
|
||||
text-align:center;
|
||||
margin-left:0;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
li {
|
||||
background-image: linear-gradient(to bottom, #f5ebe2, #f5e6d8);
|
||||
border:1px solid #f5dcc5;
|
||||
|
@ -8,12 +8,6 @@ html(lang='#{curr839}')
|
||||
link(rel='stylesheet', type='text/css', href='/styles.css')
|
||||
link(rel="stylesheet", href="/project.css")
|
||||
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
|
||||
div.container
|
||||
div#page
|
||||
@ -21,13 +15,16 @@ html(lang='#{curr839}')
|
||||
div.container#main
|
||||
p.intro
|
||||
#{dquote}
|
||||
section#git
|
||||
section#development
|
||||
h3 #{development}
|
||||
h4 #{git}
|
||||
p.center
|
||||
#{revnum}
|
||||
ul
|
||||
li #{branch}
|
||||
pre#gitdiff
|
||||
#{diff}
|
||||
h4 #{milestoneprog}
|
||||
h4 #{milestonehead}
|
||||
table#milestones.center
|
||||
tr
|
||||
th #{milestonename}
|
||||
@ -35,25 +32,27 @@ html(lang='#{curr839}')
|
||||
th #{openmilestone}
|
||||
th #{closedmilestone}
|
||||
each milestone in milestones
|
||||
- var mstone = "milestone"
|
||||
- var wd = "width:"
|
||||
- var pc = "%"
|
||||
- var wdth = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
|
||||
tr(id=mstone+milestone.number)
|
||||
- var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
|
||||
tr(id="milestone"+milestone.number)
|
||||
td
|
||||
a(href=milestone.url)
|
||||
a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number)
|
||||
#{milestone.title}
|
||||
td
|
||||
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.closed_issues}
|
||||
p.center
|
||||
a(href="https://github.com/"+repo) #{propaganda}
|
||||
section#config
|
||||
h3 #{config}
|
||||
ul
|
||||
li #{currlang}
|
||||
li #{debugmode}
|
||||
each message in configList
|
||||
li #{message}
|
||||
h4 #{loadmod}
|
||||
ul#modules
|
||||
each module in modules
|
||||
|
Loading…
Reference in New Issue
Block a user