3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00

Format stuff

## Changelog:

 - Remove Github status call.
 + Closed issues
 + Localised <h1>
 + Add introductory paragraph
 + Add last diff to page
 - Remove jade include to layout.jade
 + Dynamic language metadata
 + CSS
 + Progress bars

 ## Known issues:
 * Loading the closed milestones raises an exception for some reason;
   in a try-catch for now, unsure how to fix.

 ## Still to do:
 * Style loaded modules section (columns?)
 * Shrink footer
 * Do we need a shorthand hash by the revision?
 * Pull req count? (low priority)
This commit is contained in:
Douglas Gardner 2013-04-18 16:12:01 +00:00
parent 985b53c768
commit f7dbe77838
3 changed files with 92 additions and 43 deletions

View File

@ -4,13 +4,20 @@ var exec = require('child_process').exec,
var pages = function(dbot) { var pages = function(dbot) {
var rev; var rev;
exec("git rev-list --all | wc -l", function(a,b,c){rev = b}); exec("git rev-list --all | wc -l", function(a,b,c){rev = b});
var gstatus; var diff;
dbot.api.github.githubStatus(function(a){gstatus = a}); exec("git log -1", function(a, b, c){diff = b});
/* 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", function(e, r, b){ request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones", function(e, r, b){
milestones = JSON.parse(b); milestones = JSON.parse(b);
request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=closed", function (a, c, d){
var milestones2 = [];
try{
milestones2 = JSON.parse(c);
} catch(e){}
milestones = milestones.concat(milestones2)
});
}); });
@ -18,6 +25,9 @@ var pages = function(dbot) {
'/project': function(req, res) { '/project': function(req, res) {
res.render('project', { res.render('project', {
"name": dbot.config.name, "name": dbot.config.name,
"intro": dbot.t("dbotintro", {
"botname": dbot.config.name
}),
"curr839": dbot.config.language, "curr839": dbot.config.language,
"currver": dbot.config.version, "currver": dbot.config.version,
"currlang": dbot.t("dbotspeaks",{ "currlang": dbot.t("dbotspeaks",{
@ -35,14 +45,16 @@ var pages = function(dbot) {
"modules": dbot.config.moduleNames, "modules": dbot.config.moduleNames,
"loadmod": dbot.t("loadedmodules"), "loadmod": dbot.t("loadedmodules"),
"debugmode": dbot.t("debugmode-" + dbot.config.debugMode), "debugmode": dbot.t("debugmode-" + dbot.config.debugMode),
"githubstatus": gstatus,
"milestones": milestones, "milestones": milestones,
"milestoneprog": dbot.t("milestoneprog"), "milestoneprog": dbot.t("milestoneprog"),
"config": dbot.t("configoptions"), "config": dbot.t("configoptions"),
"milestonename": dbot.t("milestonename"), "milestonename": dbot.t("milestonename"),
"openmilestone": dbot.t("openmilestone"), "openmilestone": dbot.t("openmilestone"),
"closedmilestone": dbot.t("closedmilestone") "closedmilestone": dbot.t("closedmilestone"),
"diff": diff,
"pagetitle": dbot.t("pagetitle", {
"botname": dbot.config.name
})
}); });
}, },
}; };

View File

@ -1,10 +1,19 @@
{ {
"dbotintro": {
"en": "{botname} lorem ipsum dolor sit amet"
},
"dbotspeaks": { "dbotspeaks": {
"en": "{name} speaks {lang} ({langen})", "en": "{name} speaks {lang} ({langen})",
"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})"
}, },
"pagetitle": {
"en": "{botname} web interface",
"fr": "{botname} interface réseau",
"de": "{botname} Web-Interface",
"it": "{botname} interfaccia web"
},
"en": { "en": {
"en": "English", "en": "English",
"fr": "anglais", "fr": "anglais",
@ -29,12 +38,6 @@
"de": "Italienier", "de": "Italienier",
"it": "italiano" "it": "italiano"
}, },
"projectstatus": {
"en": "project status",
"fr": "situation du projet",
"de": "Projektstatus",
"it": "stato del progetto"
},
"revnum": { "revnum": {
"en": "{name} is at revision {rev} ({ver})", "en": "{name} is at revision {rev} ({ver})",
"fr": "{name} est à révision {rev} ({ver})", "fr": "{name} est à révision {rev} ({ver})",

View File

@ -1,20 +1,51 @@
extends ../layout !!!
html(lang='#{curr839}')
block content head
h2 #{projectstatus} meta(charset='utf-8')
script(type="text/javascript", src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js")
link(rel="stylesheet", type="text/css", href="http://fonts.googleapis.com/css?family=Source+Sans+Pro")
link(rel="stylesheet", type="text/css", href="/bootstrap/css/bootstrap.min.css")
link(rel='stylesheet', type='text/css', href='/styles.css')
link(rel="stylesheet", href="/project.css")
title #{pagetitle}
script(type="text/javascript", src="/project.js")
- 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
div#title #{pagetitle}
div.container#main
p.intro
#{intro}
section#git section#git
h3 Git h3 Git
p p.center
#{revnum} #{revnum}
pre#gitdiff
#{diff}
h4 #{milestoneprog} h4 #{milestoneprog}
table table#milestones.center
tr tr
th #{milestonename} th #{milestonename}
th #{milestoneprog}
th #{openmilestone} th #{openmilestone}
th #{closedmilestone} th #{closedmilestone}
each milestone in milestones each milestone in milestones
tr - 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)
td #{milestone.title} td #{milestone.title}
td
div.progress(class=milestone.state)
div.progress-inner(style=wd+wdth+pc)(class=milestone.state)
&nbsp;
td #{milestone.open_issues} td #{milestone.open_issues}
td #{milestone.closed_issues} td #{milestone.closed_issues}
section#config section#config
@ -29,3 +60,6 @@ block content
section#footer section#footer
p p
#{currver} #{currver}
script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js")
script(type="text/javascript", src="/d3/d3.v3.min.js")
script(type="text/javascript", src="/script.js")