From f7dbe778389e4a539d5105971522b997b7ad1b0c Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Thu, 18 Apr 2013 16:12:01 +0000 Subject: [PATCH] Format stuff ## Changelog: - Remove Github status call. + Closed issues + Localised

+ 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) --- modules/project/pages.js | 24 ++++++--- modules/project/strings.json | 15 +++--- views/project/project.jade | 96 ++++++++++++++++++++++++------------ 3 files changed, 92 insertions(+), 43 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index c5b64ca..d39444b 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -3,14 +3,21 @@ var exec = require('child_process').exec, var pages = function(dbot) { var rev; - exec("git rev-list --all | wc -l", function(a,b,c){rev = b}); - var gstatus; - dbot.api.github.githubStatus(function(a){gstatus = a}); + exec("git rev-list --all | wc -l", function(a,b,c){rev = b}); + var diff; + exec("git log -1", function(a, b, c){diff = b}); /* TODO: merge back into github module */ var milestones; request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones", function(e, r, 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) { res.render('project', { "name": dbot.config.name, + "intro": dbot.t("dbotintro", { + "botname": dbot.config.name + }), "curr839": dbot.config.language, "currver": dbot.config.version, "currlang": dbot.t("dbotspeaks",{ @@ -35,14 +45,16 @@ var pages = function(dbot) { "modules": dbot.config.moduleNames, "loadmod": dbot.t("loadedmodules"), "debugmode": dbot.t("debugmode-" + dbot.config.debugMode), - "githubstatus": gstatus, "milestones": milestones, "milestoneprog": dbot.t("milestoneprog"), "config": dbot.t("configoptions"), "milestonename": dbot.t("milestonename"), "openmilestone": dbot.t("openmilestone"), - "closedmilestone": dbot.t("closedmilestone") - + "closedmilestone": dbot.t("closedmilestone"), + "diff": diff, + "pagetitle": dbot.t("pagetitle", { + "botname": dbot.config.name + }) }); }, }; diff --git a/modules/project/strings.json b/modules/project/strings.json index 1214a67..fcbd253 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -1,10 +1,19 @@ { + "dbotintro": { + "en": "{botname} lorem ipsum dolor sit amet" + }, "dbotspeaks": { "en": "{name} speaks {lang} ({langen})", "de": "{name} spricht {lang} ({langen})", "fr": "{name} parle {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": "English", "fr": "anglais", @@ -29,12 +38,6 @@ "de": "Italienier", "it": "italiano" }, - "projectstatus": { - "en": "project status", - "fr": "situation du projet", - "de": "Projektstatus", - "it": "stato del progetto" - }, "revnum": { "en": "{name} is at revision {rev} ({ver})", "fr": "{name} est à révision {rev} ({ver})", diff --git a/views/project/project.jade b/views/project/project.jade index 2f1c7ed..e822db3 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -1,31 +1,65 @@ -extends ../layout - -block content - h2 #{projectstatus} - section#git - h3 Git - p - #{revnum} - h4 #{milestoneprog} - table - tr - th #{milestonename} - th #{openmilestone} - th #{closedmilestone} - each milestone in milestones - tr - td #{milestone.title} - td #{milestone.open_issues} - td #{milestone.closed_issues} - section#config - h3 #{config} - ul - li #{currlang} - li #{debugmode} - h4 #{loadmod} - ul - each module in modules - li #{module} - section#footer - p - #{currver} +!!! +html(lang='#{curr839}') + head + 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 + h3 Git + p.center + #{revnum} + pre#gitdiff + #{diff} + h4 #{milestoneprog} + table#milestones.center + tr + th #{milestonename} + th #{milestoneprog} + 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) + td #{milestone.title} + td + div.progress(class=milestone.state) + div.progress-inner(style=wd+wdth+pc)(class=milestone.state) +   + td #{milestone.open_issues} + td #{milestone.closed_issues} + section#config + h3 #{config} + ul + li #{currlang} + li #{debugmode} + h4 #{loadmod} + ul + each module in modules + li #{module} + section#footer + p + #{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")