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 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);
});
@ -32,6 +35,10 @@ var pages = function(dbot) {
"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 +49,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 +65,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")
});
},
};

View File

@ -3,10 +3,13 @@
"en": "{botname} lorem ipsum dolor sit amet"
},
"dbotspeaks": {
"en": "{name} speaks {lang}",
"de": "{name} spricht {lang} ({langen})",
"fr": "{name} parle {lang} ({langen})",
"it": "{name} parla {lang} ({langen})"
"en": "{name} speaks {lang}",
"de": "{name} spricht {lang} ({langen})",
"fr": "{name} parle {lang} ({langen})",
"it": "{name} parla {lang} ({langen})"
},
"branch": {
"en": "{branch}"
},
"pagetitle": {
"en": "{botname} web interface",
@ -111,10 +114,23 @@
"de": "Name",
"it": "Nome"
},
"milestones": {
"en": "Milestones"
},
"development": {
"en": "Development",
"fr": "Développement",
"de": "Entwicklung",
"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 {
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;

View File

@ -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,19 @@ html(lang='#{curr839}')
div.container#main
p.intro
#{dquote}
section#git
section#development
h3 #{development}
h4 #{git}
p.center
#{revnum}
p.center
a(href="https://github.com/"+repo) #{propaganda}
ul
li #{branch}
pre#gitdiff
#{diff}
h4 #{milestoneprog}
h4 #{milestonehead}
table#milestones.center
tr
th #{milestonename}
@ -35,18 +35,16 @@ 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}
section#config