3
0
mirror of https://github.com/reality/dbot.git synced 2025-01-11 20:42:37 +01:00

Tidy up the project module some more

## Additions
 + Add current branch to display
 + Pass Github repo through to the page
 + Add link to source
 + Differentiate "progress bar" and "milestone" headers again
 + Add Git ``h4``, renamed "version control" because it's more interesting
   to translate
 + Add progress percentages to the progress bars

 - Remove redundant short-hash placeholder
 - Remove extraneous margins on ``ul``
 - Simplify progress calculation code

 * Change some variable names to be more forthcoming about what they
   represent
 * Fix links to the milestones
 * Fix indentation of strings.json
This commit is contained in:
Douglas Gardner 2013-04-19 04:28:03 +00:00
parent b4fdfb5104
commit a61a2300ab
4 changed files with 62 additions and 31 deletions

View File

@ -3,19 +3,22 @@ var exec = require('child_process').exec,
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) { exec("git rev-parse --abbrev-ref HEAD", function(error, stdout, stderr) {
diff = b 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);
}); });
@ -32,6 +35,10 @@ var pages = function(dbot) {
"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 +49,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 +65,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

@ -3,10 +3,13 @@
"en": "{botname} lorem ipsum dolor sit amet" "en": "{botname} lorem ipsum dolor sit amet"
}, },
"dbotspeaks": { "dbotspeaks": {
"en": "{name} speaks {lang}", "en": "{name} speaks {lang}",
"de": "{name} spricht {lang} ({langen})", "de": "{name} spricht {lang} ({langen})",
"fr": "{name} parle {lang} ({langen})", "fr": "{name} parle {lang} ({langen})",
"it": "{name} parla {lang} ({langen})" "it": "{name} parla {lang} ({langen})"
},
"branch": {
"en": "{branch}"
}, },
"pagetitle": { "pagetitle": {
"en": "{botname} web interface", "en": "{botname} web interface",
@ -111,10 +114,23 @@
"de": "Name", "de": "Name",
"it": "Nome" "it": "Nome"
}, },
"milestones": {
"en": "Milestones"
},
"development": { "development": {
"en": "Development", "en": "Development",
"fr": "Développement", "fr": "Développement",
"de": "Entwicklung", "de": "Entwicklung",
"it": "Sviluppo" "it": "Sviluppo"
},
"git" : {
"en": "Version Control",
"fr": "Gestion de Versions",
"de": "Versionsverwaltung",
"it": "Controllo versione"
},
"propaganda": {
"en": "Contribute via Github!",
"fr": "Contribuer via Github!"
} }
} }

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,19 @@ 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}
p.center
a(href="https://github.com/"+repo) #{propaganda}
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,18 +35,16 @@ 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}
section#config section#config