From a61a2300abd0247e6a86331b86359b7e4a58206e Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Fri, 19 Apr 2013 04:28:03 +0000 Subject: [PATCH 01/14] 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 --- modules/project/pages.js | 29 +++++++++++++++++++---------- modules/project/strings.json | 24 ++++++++++++++++++++---- public/project.css | 12 ++++++++++-- views/project/project.jade | 28 +++++++++++++--------------- 4 files changed, 62 insertions(+), 31 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index a724636..ee0059b 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -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") }); }, }; diff --git a/modules/project/strings.json b/modules/project/strings.json index 5afa320..0fcc665 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -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!" } } diff --git a/public/project.css b/public/project.css index 7d382b2..0659a28 100644 --- a/public/project.css +++ b/public/project.css @@ -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; diff --git a/views/project/project.jade b/views/project/project.jade index dcf7141..a466143 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -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 From bddb7ccce42abfa4e423e4b1b757c59d90a01896 Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Fri, 19 Apr 2013 10:55:20 +0000 Subject: [PATCH 02/14] Add more configuration splurge + Added dependency on underscore + Added displaying of some configuration options for dent, link, quotes, report and web + Translated (badly) the word "Milestones" * Translated and moved the github advert to below the milestones --- modules/project/pages.js | 38 ++++++++++++++++++++++++++++++++++-- modules/project/strings.json | 27 +++++++++++++++++++++++-- views/project/project.jade | 7 ++++--- 3 files changed, 65 insertions(+), 7 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index ee0059b..87dcad4 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -1,5 +1,6 @@ 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], @@ -14,7 +15,39 @@ var pages = function(dbot) { exec("git log -1", function(error, stdout, stderr) { diff = stdout }); - + var configList = []; + if(_.has(dbot.modules,'dent')){ + configList.push(dbot.t("dent-account", { + "username": dbot.config.dent.username + })); + if(dbot.config.dent.dentQuotes) { + configList.push(dbot.t("dent-push")); + } + } + if(_.has(dbot.modules,'link')){ + if(dbot.config.link.autoTitle){ + configList.push(dbot.t("link-autotitle")); + } + } + if(_.has(dbot.modules,'quotes')){ + configList.push(dbot.t("quote-rmlimit", { + "limit": dbot.config.quotes.rmLimit + })); + } + if(_.has(dbot.modules,'report')){ + if(dbot.config.report.notifyVoice){ + configList.push(dbot.t("report-notifyvoice")); + } + } + if(_.has(dbot.modules,'web')){ + configList.push(dbot.t("web-port", { + "port": dbot.config.web.webPort + })); + } + + + + /* TODO: merge back into github module */ var milestones; request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(error, response, body){ @@ -30,6 +63,7 @@ var pages = function(dbot) { } res.render('project', { + "configList": configList, "name": dbot.config.name, "intro": dbot.t("dbotintro", { "botname": dbot.config.name diff --git a/modules/project/strings.json b/modules/project/strings.json index 0fcc665..4454dce 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -115,7 +115,10 @@ "it": "Nome" }, "milestones": { - "en": "Milestones" + "en": "Milestones", + "it": "tappe", + "fr": "étapes", + "de": "Etappenziele" }, "development": { "en": "Development", @@ -131,6 +134,26 @@ }, "propaganda": { "en": "Contribute via Github!", - "fr": "Contribuer via Github!" + "fr": "Contribuer via Github!", + "it": "Contribuire con Github!", + "de": "Beisteuern Github" + }, + "dent-account": { + "en": "{name} dents as @{username}" + }, + "dent-push": { + "en": "Quotes are automatically dented" + }, + "link-autotitle": { + "en": "Links are automatically titled" + }, + "quote-rmlimit": { + "en": "Quote removal throttle set to {limit}" + }, + "report-notifyvoice": { + "en": "Reports are sent to voiced users" + }, + "web-port": { + "en": "Running web interface on {port}" } } diff --git a/views/project/project.jade b/views/project/project.jade index a466143..8dd2ee3 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -20,9 +20,6 @@ html(lang='#{curr839}') h4 #{git} p.center #{revnum} - p.center - a(href="https://github.com/"+repo) #{propaganda} - ul li #{branch} pre#gitdiff @@ -47,11 +44,15 @@ html(lang='#{curr839}') 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 From 95e7d0ee80c31a879e6dc8d954cc1d3a256d235f Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 20 Apr 2013 00:59:31 +0000 Subject: [PATCH 03/14] readd strings after weird git explosion --- modules/project/strings.json | 168 +++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 modules/project/strings.json diff --git a/modules/project/strings.json b/modules/project/strings.json new file mode 100644 index 0000000..a66b1d9 --- /dev/null +++ b/modules/project/strings.json @@ -0,0 +1,168 @@ +{ + "dbotintro": { + "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})", + "nl": "{name} spreekt {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", + "de": "Englisch", + "it": "inglese", + "cy": "saesneg", + "nl": "Engels" + }, + "fr": { + "en": "French", + "fr": "français", + "de": "Französisch", + "it": "francese", + "nl": "Frans" + }, + "de": { + "en": "German", + "fr": "allemande", + "de": "Deutsch", + "it": "tedesco", + "nl": "Duits" + }, + "it": { + "en": "Italian", + "fr": "italien", + "de": "Italiener", + "it": "italiano", + "nl": "Italiaans" + }, + "cy": { + "en": "Welsh", + "fr": "gallois", + "de": "Walisisch", + "it": "gallese", + "cy": "cymraeg", + "nl": "Welsh" + }, + "na'vi": { + "en": "Na'vi", + "fr": "na'vi", + "de": "Na'vi", + "it": "Na'vi", + "nl": "Na'vi" + }, + "es": { + "en": "Spanish", + "fr": "espagnole", + "de": "Spanisch", + "it": "spagnolo", + "nl": "Spaans" + }, + "nl": { + "en": "Dutch" + }, + "revnum": { + "en": "{name} is at revision {rev}", + "fr": "{name} est à révision {rev}", + "de": "{name} ist in der Revision {rev}", + "it": "{name} il numero di revisione {rev}", + "nl": "{name} is bij revisie {rev}" + }, + "loadedmodules": { + "en": "loaded modules", + "fr": "modules chargés", + "it": "moduli caricati", + "nl": "geladen modules" + }, + "configoptions": { + "en": "Configuration", + "fr": "Configuration", + "de": "Konfiguration", + "it": "Configuazione", + "nl": "Configuratie" + }, + "debugmode-true": { + "en": "Debug mode active", + "fr": "debug actif", + "de": "Debug aktiv", + "it": "debug attivo", + "nl": "Debug actief" + }, + "debugmode-false": { + "en": "Debug off", + "fr": "debug éteint", + "de": "Debug ausgeschaltet", + "it": "debug spento", + "nl": "Debug uitgeschakeld" + }, + "milestones": { + "en": "Milestones" + }, + "milestoneprog": { + "en": "Progress", + "fr": "Progression", + "de": "Fortschritt", + "it": "sviluppo", + "nl": "Voortgang" + }, + "openmilestone": { + "en": "Open", + "fr": "Ouvert", + "de": "Offen", + "it": "Aperto", + "nl": "Open" + }, + "closedmilestone": { + "en": "Closed", + "fr": "Fermé", + "de": "Gesperrt", + "it": "Chiuso", + "nl": "Gesloten" + }, + "milestonename": { + "en": "Name", + "fr": "Nom", + "de": "Name", + "it": "Nome", + "nl": "Naam" + }, + "development": { + "en": "Development", + "fr": "Développement", + "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" + } +} From 123095f624e0492111ff84209814fd9dfacf273f Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 20 Apr 2013 17:38:00 +0000 Subject: [PATCH 04/14] fix malformed JSON --- modules/project/strings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/project/strings.json b/modules/project/strings.json index 4e2407e..9533593 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -13,7 +13,7 @@ "en": "{botname} web interface", "fr": "{botname} interface réseau", "de": "{botname} Web-Interface", - "it": "{botname} interfaccia web", + "it": "{botname} interfaccia web" }, "en": { "en": "English", From adcd5803b06229289f610f5871659e7dcaa7e6cb Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 20 Apr 2013 17:42:34 +0000 Subject: [PATCH 05/14] move some stuff to project.js --- modules/project/pages.js | 40 +++++---------------------------- modules/project/project.js | 45 ++++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 87dcad4..1412471 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -9,45 +9,15 @@ var pages = function(dbot) { exec("git rev-list --all | wc -l", function(error, stdout, stderr) { rev = stdout }); + exec("git rev-parse --abbrev-ref HEAD", function(error, stdout, stderr) { branch = stdout }); + exec("git log -1", function(error, stdout, stderr) { diff = stdout - }); - var configList = []; - if(_.has(dbot.modules,'dent')){ - configList.push(dbot.t("dent-account", { - "username": dbot.config.dent.username - })); - if(dbot.config.dent.dentQuotes) { - configList.push(dbot.t("dent-push")); - } - } - if(_.has(dbot.modules,'link')){ - if(dbot.config.link.autoTitle){ - configList.push(dbot.t("link-autotitle")); - } - } - if(_.has(dbot.modules,'quotes')){ - configList.push(dbot.t("quote-rmlimit", { - "limit": dbot.config.quotes.rmLimit - })); - } - if(_.has(dbot.modules,'report')){ - if(dbot.config.report.notifyVoice){ - configList.push(dbot.t("report-notifyvoice")); - } - } - if(_.has(dbot.modules,'web')){ - configList.push(dbot.t("web-port", { - "port": dbot.config.web.webPort - })); - } - - - - + }); + /* TODO: merge back into github module */ var milestones; request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(error, response, body){ @@ -63,7 +33,7 @@ var pages = function(dbot) { } res.render('project', { - "configList": configList, + "configList": "", // what variable do I put here "name": dbot.config.name, "intro": dbot.t("dbotintro", { "botname": dbot.config.name diff --git a/modules/project/project.js b/modules/project/project.js index 25e3e35..302b504 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -4,10 +4,47 @@ * the dbot. */ -var project = function(dbot) { - // Nothing to see here go away love zuzak -} +_ = require('underscore'), + exec = require('child_process').exec; -exports.fetch = function(dbot) { +var project = function(dbot) { + + this.onLoad = function() { + var configList = function(){ + var list = []; + if(_.has(dbot.modules,'dent')){ + configList.push(dbot.t("dent-account", { + "username": dbot.config.dent.username + })); + } + if(dbot.config.dent.dentQuotes) { + configList.push(dbot.t("dent-push")); + } + if(_.has(dbot.modules,'link')){ + if(dbot.config.link.autoTitle){ + configList.push(dbot.t("link-autotitle")); + } + } + if(_.has(dbot.modules,'quotes')){ + configList.push(dbot.t("quote-rmlimit", { + "limit": dbot.config.quotes.rmLimit + })); + } + if(_.has(dbot.modules,'report')){ + if(dbot.config.report.notifyVoice){ + configList.push(dbot.t("report-notifyvoice")); + } + } + if(_.has(dbot.modules,'web')){ + configList.push(dbot.t("web-port", { + "port": dbot.config.web.webPort + })); + } + return list; + }.bind(this); + }.bind(this); +} + +exports.fetch = function(dbot){ return new project(dbot); } From 9d727a211e51b496a5e579b05eaaace010efa9ca Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 20 Apr 2013 20:00:59 +0000 Subject: [PATCH 06/14] Complete project module (for now) - Remove unused modules from ``config.json`` * Move config list stuff from ``onLoad`` to ``api`` The api call might be useful elsewhere --- modules/project/pages.js | 2 +- modules/project/project.js | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 1412471..76bbe4b 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -33,7 +33,7 @@ var pages = function(dbot) { } res.render('project', { - "configList": "", // what variable do I put here + "configList": dbot.modules.project.api.configList(), // what variable do I put here "name": dbot.config.name, "intro": dbot.t("dbotintro", { "botname": dbot.config.name diff --git a/modules/project/project.js b/modules/project/project.js index 302b504..ba256e1 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -4,45 +4,44 @@ * the dbot. */ -_ = require('underscore'), - exec = require('child_process').exec; +_ = require('underscore'); var project = function(dbot) { - this.onLoad = function() { - var configList = function(){ + this.api = { + 'configList' : function(callback){ var list = []; if(_.has(dbot.modules,'dent')){ - configList.push(dbot.t("dent-account", { + list.push(dbot.t("dent-account", { "username": dbot.config.dent.username })); } if(dbot.config.dent.dentQuotes) { - configList.push(dbot.t("dent-push")); + list.push(dbot.t("dent-push")); } if(_.has(dbot.modules,'link')){ if(dbot.config.link.autoTitle){ - configList.push(dbot.t("link-autotitle")); + list.push(dbot.t("link-autotitle")); } } if(_.has(dbot.modules,'quotes')){ - configList.push(dbot.t("quote-rmlimit", { + list.push(dbot.t("quote-rmlimit", { "limit": dbot.config.quotes.rmLimit })); } if(_.has(dbot.modules,'report')){ if(dbot.config.report.notifyVoice){ - configList.push(dbot.t("report-notifyvoice")); + list.push(dbot.t("report-notifyvoice")); } } if(_.has(dbot.modules,'web')){ - configList.push(dbot.t("web-port", { + list.push(dbot.t("web-port", { "port": dbot.config.web.webPort })); } return list; - }.bind(this); - }.bind(this); + } + }; } exports.fetch = function(dbot){ From 0b44f7afb8c0e07947e2a66ec490503b4a5a94fb Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 20 Apr 2013 23:27:50 +0000 Subject: [PATCH 07/14] add WIP m"" # mm#mm m m mmm # m mmm mmm m m m mm mmm # # # #" " # m" " # # " "m m" #" # #" " # # # # #"# m"""# """m #m# # # # # "mm"# "#mm" # "m "mm"# "mmm" "# # # "#mm" m" "" --- modules/project/pages.js | 5 ++- modules/project/project.js | 18 +++++++--- modules/project/strings.json | 6 ++++ views/project/project.jade | 67 ++++++++++++++++++++---------------- 4 files changed, 60 insertions(+), 36 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 76bbe4b..2adedc4 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -33,7 +33,10 @@ var pages = function(dbot) { } res.render('project', { - "configList": dbot.modules.project.api.configList(), // what variable do I put here + "configList": dbot.modules.project.api.configList(), + "authors": dbot.modules.project.api.getAuthors(), + "credits": dbot.t("credits"), + "thanks": dbot.t("thanks"), "name": dbot.config.name, "intro": dbot.t("dbotintro", { "botname": dbot.config.name diff --git a/modules/project/project.js b/modules/project/project.js index ba256e1..48ed053 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -4,7 +4,8 @@ * the dbot. */ -_ = require('underscore'); +_ = require('underscore'), + exec = require('child_process').exec; var project = function(dbot) { @@ -16,7 +17,7 @@ var project = function(dbot) { "username": dbot.config.dent.username })); } - if(dbot.config.dent.dentQuotes) { + if(_.has(dbot.config.dent.dentQuotes)) { list.push(dbot.t("dent-push")); } if(_.has(dbot.modules,'link')){ @@ -40,10 +41,17 @@ var project = function(dbot) { })); } return list; + }, + 'getAuthors': function(callback) { + var foo = ['a','b','c']; + exec("git rev-list --all | wc -l", function(error, stdout, stderr){ + foo.push(stdout); + }); + callback(foo); } - }; -} - + } +} + exports.fetch = function(dbot){ return new project(dbot); } diff --git a/modules/project/strings.json b/modules/project/strings.json index a66b1d9..f3c80b5 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -9,6 +9,12 @@ "it": "{name} parla {lang} ({langen})", "nl": "{name} spreekt {lang} ({langen})" }, + "thanks": { + "en": "With thanks to:" + }, + "credits": { + "en": "Authors" + }, "pagetitle": { "en": "{botname} web interface", "fr": "{botname} interface réseau", diff --git a/views/project/project.jade b/views/project/project.jade index 8dd2ee3..ddc04c5 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -16,36 +16,43 @@ html(lang='#{curr839}') p.intro #{dquote} section#development - h3 #{development} - h4 #{git} - p.center - #{revnum} - ul - li #{branch} - pre#gitdiff - #{diff} - h4 #{milestonehead} - table#milestones.center - tr - th #{milestonename} - th #{milestoneprog} - th #{openmilestone} - th #{closedmilestone} - each milestone in milestones - - var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100) - tr(id="milestone"+milestone.number) - td - a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number) - #{milestone.title} - td - div.progress(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} + h3 #{development} + h4 #{git} + p.center + #{revnum} + ul + li #{branch} + pre#gitdiff + #{diff} + h4 #{milestonehead} + table#milestones.center + tr + th #{milestonename} + th #{milestoneprog} + th #{openmilestone} + th #{closedmilestone} + each milestone in milestones + - var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100) + tr(id="milestone"+milestone.number) + td + a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number) + #{milestone.title} + td + div.progress(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} + h4 + #{credits} + p.center + #{thanks} + ul + each author in authors + li #{author} section#config h3 #{config} ul From e5b2f8c8f275d72519480c4a2ce49f7729810761 Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sun, 21 Apr 2013 05:06:26 +0000 Subject: [PATCH 08/14] Add list of authors; shrink tag sizes --- modules/project/pages.js | 16 +++++++++++++--- public/project.css | 1 + views/project/project.jade | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 2adedc4..7d964de 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -4,16 +4,26 @@ var exec = require('child_process').exec, var pages = function(dbot) { var quoteCat = dbot.db.quoteArrs[dbot.config.name], - rev, diff, branch; + rev, diff, branch, credit, authors = []; + exec("git log --format='%cN¬' | sort -u | tr -d '\n'", function (error, stdout, sderr) { + var credit = stdout.split("¬"); // nobody uses ¬, do they? + for (var i = 0; i < credit.length; i++) { + if ((credit[i].split(" ").length) == 2){ + console.log(credit[i]); + authors.push(credit[i]); + } + } + }); exec("git rev-list --all | wc -l", function(error, stdout, stderr) { - rev = stdout + rev = stdout; }); exec("git rev-parse --abbrev-ref HEAD", function(error, stdout, stderr) { branch = stdout }); + exec("git log -1", function(error, stdout, stderr) { diff = stdout }); @@ -34,7 +44,7 @@ var pages = function(dbot) { res.render('project', { "configList": dbot.modules.project.api.configList(), - "authors": dbot.modules.project.api.getAuthors(), + "authors": authors, //dbot.modules.project.api.getAuthors(), "credits": dbot.t("credits"), "thanks": dbot.t("thanks"), "name": dbot.config.name, diff --git a/public/project.css b/public/project.css index 0659a28..6b36846 100644 --- a/public/project.css +++ b/public/project.css @@ -59,6 +59,7 @@ ul { text-align:center; margin-left:0; margin-bottom:5px; + font-size:80%; } li { background-image: linear-gradient(to bottom, #f5ebe2, #f5e6d8); diff --git a/views/project/project.jade b/views/project/project.jade index ddc04c5..9f5e3cd 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -50,7 +50,7 @@ html(lang='#{curr839}') #{credits} p.center #{thanks} - ul + ul#credits each author in authors li #{author} section#config From 295c5ba2bc9ffd8086f6cf62be845125608bff9f Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sun, 21 Apr 2013 05:11:52 +0000 Subject: [PATCH 09/14] Move title left a bit to account a tad for curve --- public/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/styles.css b/public/styles.css index 5786bcc..39703bb 100644 --- a/public/styles.css +++ b/public/styles.css @@ -44,7 +44,7 @@ div#backlink { div#title { font-size: 42px; font-weight: bold; - margin: 0 0 10px 0; + margin: 0 0 10px 10px; color: #444; } From 47d5404f38767ef783d13d3af56e7ba7003e136b Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sun, 21 Apr 2013 12:18:24 +0000 Subject: [PATCH 10/14] Add beginnings of translation progress API * Add totally legit and optimised code to find the number of strings in each language. * Add this as an API call * Add strings for ``na'vi``, ``es`` and ``nl`` for their own language names * Optimise CSS a bit * Add classes for the languages, for testing purposes --- modules/project/pages.js | 11 ++++++++ modules/project/project.js | 40 ++++++++++++++++++++++------- modules/project/strings.json | 10 +++++--- public/project.css | 30 ++++++++++++++++++---- views/project/project.jade | 50 ++++++++++++++++++++---------------- 5 files changed, 102 insertions(+), 39 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 7d964de..944064f 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -15,6 +15,16 @@ var pages = function(dbot) { } }); + var trans = []; + // THIS IS TOTALLY LEGIT AND OPTIMISED CODE + /* for (var j = 0; j < Object.keys(dbot.strings).length; j++) { + var str = dbot.strings.j; + for (var k = 0; k < Object.keys(dbot.strings.str).length; k++) { + var lang = str.lang; + trans[lang]++; + } + } */ + exec("git rev-list --all | wc -l", function(error, stdout, stderr) { rev = stdout; }); @@ -43,6 +53,7 @@ var pages = function(dbot) { } res.render('project', { + "translation": dbot.modules.project.api.translationProgress(), "configList": dbot.modules.project.api.configList(), "authors": authors, //dbot.modules.project.api.getAuthors(), "credits": dbot.t("credits"), diff --git a/modules/project/project.js b/modules/project/project.js index 48ed053..b177dbe 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -42,16 +42,38 @@ var project = function(dbot) { } return list; }, - 'getAuthors': function(callback) { - var foo = ['a','b','c']; - exec("git rev-list --all | wc -l", function(error, stdout, stderr){ - foo.push(stdout); - }); - callback(foo); + 'translationProgress' : function(callback){ + var translation = []; + var str = _.values(dbot.strings); + for (var i = 0; i < str.length; i++){ + var cur = _.keys(str[i]); + for (var j = 0; j < cur.length; j++) { + translation = translation.concat(cur[j]); + } + } + // optimise this, someone who isn't me + var t = []; + for (var k = 0; k < str.length; k++) { + var curr = translation[k]; + if (t[curr]) { + t[curr]["count"] += 1; + } else { + t[curr] = []; + // t[curr]["839"] = curr; + t[curr]["count"] = 1; + t[curr]["own"] = dbot.strings[curr][curr]; + t[curr]["local"] = dbot.t(curr); + t[curr]["english"] = dbot.strings[curr]["en"]; + } + } + _.compact(t); + console.log(t); + return t; } - } -} + }; + this.api['translationProgress'].external = true; +}; exports.fetch = function(dbot){ return new project(dbot); -} +}; diff --git a/modules/project/strings.json b/modules/project/strings.json index f3c80b5..e03f30a 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -63,17 +63,21 @@ "fr": "na'vi", "de": "Na'vi", "it": "Na'vi", - "nl": "Na'vi" + "nl": "Na'vi", + "na'vi": "Na'vi" + }, "es": { "en": "Spanish", "fr": "espagnole", "de": "Spanisch", "it": "spagnolo", - "nl": "Spaans" + "nl": "Spaans", + "es": "Español" }, "nl": { - "en": "Dutch" + "en": "Dutch", + "nl": "Nederlands" }, "revnum": { "en": "{name} is at revision {rev}", diff --git a/public/project.css b/public/project.css index 6b36846..b0793a8 100644 --- a/public/project.css +++ b/public/project.css @@ -4,11 +4,9 @@ pre#gitdiff { margin:auto; } div#main { - text-align:inherit; font-size:18px; } h2,h3,h4,h5,h6,.center { - text-align:center; text-transform:lowercase; } table#milestones { @@ -19,7 +17,6 @@ table#milestones td { padding:5px; } p.intro { - text-align:center; border:1px solid #ccc; padding:20px; border-radius:4px; @@ -51,12 +48,10 @@ div.progress-inner.closed { } #config { - text-align:center; text-transform:lowercase; } ul { - text-align:center; margin-left:0; margin-bottom:5px; font-size:80%; @@ -72,3 +67,28 @@ li { #footer { font-size:80%; } +/* testing stuff */ +.en { + background-color:red; + background-image:none; +} +.fr { + background-color:blue; + background-image:none; +} +.de { + background-color:yellow; + background-image:none; +} +.nl { + background-color:darkorange; + background-image:none; +} +.cy { + background-image:palevioletred; + background-image:none; +} +.es { + background-image:none; + background-color:orchid; +} diff --git a/views/project/project.jade b/views/project/project.jade index 9f5e3cd..02c18bc 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -8,23 +8,28 @@ 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 div#title #{pagetitle} div.container#main + p.intro + p.intro #{dquote} - section#development + section#git h3 #{development} - h4 #{git} p.center #{revnum} - ul - li #{branch} pre#gitdiff #{diff} - h4 #{milestonehead} + h4 #{milestoneprog} table#milestones.center tr th #{milestonename} @@ -32,34 +37,35 @@ html(lang='#{curr839}') th #{openmilestone} th #{closedmilestone} each milestone in milestones - - var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100) - tr(id="milestone"+milestone.number) + - 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 - a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number) - #{milestone.title} + a(href=milestone.url) + #{milestone.title} td div.progress(class=milestone.state) - div.progress-inner(style="width:"+width+"%")(class=milestone.state) + div.progress-inner(style=wd+wdth+pc)(class=milestone.state)   - print #{Math.round(width)+"%"} td #{milestone.open_issues} td #{milestone.closed_issues} - p.center - a(href="https://github.com/"+repo) #{propaganda} - h4 - #{credits} - p.center - #{thanks} - ul#credits - each author in authors - li #{author} + h4 Translations + ul + each key in translation + li #{translation[0][1]} + h4 #{credits} + #{thanks} + ul + each author in authors + li + #{author} section#config h3 #{config} ul li #{currlang} li #{debugmode} - each message in configList - li #{message} h4 #{loadmod} ul#modules each module in modules From ad3e597ad21d2edc9a2a6d89341363d5f2eb897f Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sun, 21 Apr 2013 14:28:33 +0000 Subject: [PATCH 11/14] update translation information * Remove commented out code * Covert translationProgress from an array to an object * Enlargen progress meters * Add translation table --- modules/project/pages.js | 12 +----------- modules/project/project.js | 10 ++++------ public/project.css | 5 +++-- views/project/project.jade | 25 ++++++++++++++++++++++--- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 944064f..084a2d5 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -15,16 +15,6 @@ var pages = function(dbot) { } }); - var trans = []; - // THIS IS TOTALLY LEGIT AND OPTIMISED CODE - /* for (var j = 0; j < Object.keys(dbot.strings).length; j++) { - var str = dbot.strings.j; - for (var k = 0; k < Object.keys(dbot.strings.str).length; k++) { - var lang = str.lang; - trans[lang]++; - } - } */ - exec("git rev-list --all | wc -l", function(error, stdout, stderr) { rev = stdout; }); @@ -55,7 +45,7 @@ var pages = function(dbot) { res.render('project', { "translation": dbot.modules.project.api.translationProgress(), "configList": dbot.modules.project.api.configList(), - "authors": authors, //dbot.modules.project.api.getAuthors(), + "authors": authors, "credits": dbot.t("credits"), "thanks": dbot.t("thanks"), "name": dbot.config.name, diff --git a/modules/project/project.js b/modules/project/project.js index b177dbe..5d6c3a7 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -43,7 +43,7 @@ var project = function(dbot) { return list; }, 'translationProgress' : function(callback){ - var translation = []; + var translation = [] ; var str = _.values(dbot.strings); for (var i = 0; i < str.length; i++){ var cur = _.keys(str[i]); @@ -51,22 +51,20 @@ var project = function(dbot) { translation = translation.concat(cur[j]); } } - // optimise this, someone who isn't me - var t = []; + var t = {}; for (var k = 0; k < str.length; k++) { var curr = translation[k]; if (t[curr]) { t[curr]["count"] += 1; } else { - t[curr] = []; - // t[curr]["839"] = curr; + t[curr] = {}; + t[curr]["iso"] = curr; t[curr]["count"] = 1; t[curr]["own"] = dbot.strings[curr][curr]; t[curr]["local"] = dbot.t(curr); t[curr]["english"] = dbot.strings[curr]["en"]; } } - _.compact(t); console.log(t); return t; } diff --git a/public/project.css b/public/project.css index b0793a8..9049548 100644 --- a/public/project.css +++ b/public/project.css @@ -9,11 +9,11 @@ div#main { h2,h3,h4,h5,h6,.center { text-transform:lowercase; } -table#milestones { +table { margin:auto; width:80%; } -table#milestones td { +table td { padding:5px; } p.intro { @@ -31,6 +31,7 @@ div.progress { text-align:left; font-size:50%; color:gray; + min-width:200px; } div.progress-inner.open { background-color: #3fff3f; diff --git a/views/project/project.jade b/views/project/project.jade index 02c18bc..3743218 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -52,9 +52,28 @@ html(lang='#{curr839}') td #{milestone.open_issues} td #{milestone.closed_issues} h4 Translations - ul - each key in translation - li #{translation[0][1]} + table + tr + th Current + th Native + th English + th Progress + th Translations + each language in translation + - var w = ((language.count/translation.en.count)*100) + tr + td #{language.local} + td #{language.own} + td #{language.english} + td.prog + div.progress(class="open") + unless (language.iso == curr839) + div.progress-inner(style="width:"+w+"%")(class="open") +   + else + div.progress-inner(style="width:"+w+"%")(class="closed") +   + td #{language.count} / #{translation.en.count} h4 #{credits} #{thanks} ul From 151d0e6fcbc77e237ac6d9bfe128d068f9e1e573 Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sun, 21 Apr 2013 14:53:04 +0000 Subject: [PATCH 12/14] Add translations; toggle lowercase; remove testCSS --- modules/project/pages.js | 8 +++++++- modules/project/strings.json | 15 +++++++++++++++ public/project.css | 32 +------------------------------- views/project/project.jade | 27 +++++++++++++-------------- 4 files changed, 36 insertions(+), 46 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 084a2d5..ed94690 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -86,7 +86,13 @@ var pages = function(dbot) { }), "git": dbot.t("git"), "milestonehead": dbot.t("milestones"), - "propaganda": dbot.t("propaganda") + "propaganda": dbot.t("propaganda"), + "languagecurr": dbot.t(dbot.config.language), + "languagenati": dbot.t("langhead-native"), + "languageeng": dbot.t("en"), + "languageprog": dbot.t("langhead-progress"), + "languagetrans": dbot.t("langhead-translations"), + "languagetranshead": dbot.t("translations") }); }, }; diff --git a/modules/project/strings.json b/modules/project/strings.json index e03f30a..8960da3 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -174,5 +174,20 @@ }, "git": { "en": "version control" + }, + "langhead-current": { + "en": "Current" + }, + "langhead-translations": { + "en": "Completion" + }, + "translations": { + "en": "Translations" + }, + "langhead-progress": { + "en": "Translation Progress" + }, + "langhead-native": { + "en": "Native" } } diff --git a/public/project.css b/public/project.css index 9049548..3e71250 100644 --- a/public/project.css +++ b/public/project.css @@ -2,11 +2,10 @@ pre#gitdiff { text-align:left; width:80; margin:auto; + text-transform:none; } div#main { font-size:18px; -} -h2,h3,h4,h5,h6,.center { text-transform:lowercase; } table { @@ -48,10 +47,6 @@ div.progress-inner.closed { background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f); } -#config { - text-transform:lowercase; -} - ul { margin-left:0; margin-bottom:5px; @@ -68,28 +63,3 @@ li { #footer { font-size:80%; } -/* testing stuff */ -.en { - background-color:red; - background-image:none; -} -.fr { - background-color:blue; - background-image:none; -} -.de { - background-color:yellow; - background-image:none; -} -.nl { - background-color:darkorange; - background-image:none; -} -.cy { - background-image:palevioletred; - background-image:none; -} -.es { - background-image:none; - background-color:orchid; -} diff --git a/views/project/project.jade b/views/project/project.jade index 3743218..d447388 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -19,8 +19,6 @@ html(lang='#{curr839}') div#page div#title #{pagetitle} div.container#main - p.intro - p.intro #{dquote} section#git @@ -51,14 +49,14 @@ html(lang='#{curr839}')   td #{milestone.open_issues} td #{milestone.closed_issues} - h4 Translations + h4 #{languagetranshead} table tr - th Current - th Native - th English - th Progress - th Translations + th #{languagecurr} + th #{languagenati} + th #{languageeng} + th #{languageprog} + th #{languagetrans} each language in translation - var w = ((language.count/translation.en.count)*100) tr @@ -66,13 +64,14 @@ html(lang='#{curr839}') td #{language.own} td #{language.english} td.prog - div.progress(class="open") - unless (language.iso == curr839) - div.progress-inner(style="width:"+w+"%")(class="open") -   + unless (language.iso == curr839) + div.progress(class="open") + div.progress-inner(style="width:"+w+"%")(class="open") +   else - div.progress-inner(style="width:"+w+"%")(class="closed") -   + div.progress(class="closed") + div.progress-inner(style="width:"+w+"%")(class="closed") +   td #{language.count} / #{translation.en.count} h4 #{credits} #{thanks} From 0376926dfcb20226c704b433458a56bc9777df9f Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sun, 21 Apr 2013 15:11:34 +0000 Subject: [PATCH 13/14] add percentages to progress bars; tidy translation * If the current language is English, the second "English" column will no longer display. * Progress bars have percentages again. * Some jade logic has been simplified. --- views/project/project.jade | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/views/project/project.jade b/views/project/project.jade index d447388..fa865d7 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -35,9 +35,6 @@ 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) td @@ -45,8 +42,9 @@ html(lang='#{curr839}') #{milestone.title} td div.progress(class=milestone.state) - div.progress-inner(style=wd+wdth+pc)(class=milestone.state) + div.progress-inner(style="width:"+wdth+"%")(class=milestone.state)   + print #{Math.round(wdth)+"%"} td #{milestone.open_issues} td #{milestone.closed_issues} h4 #{languagetranshead} @@ -54,7 +52,8 @@ html(lang='#{curr839}') tr th #{languagecurr} th #{languagenati} - th #{languageeng} + unless (curr839 == "en") + th #{languageeng} th #{languageprog} th #{languagetrans} each language in translation @@ -62,16 +61,19 @@ html(lang='#{curr839}') tr td #{language.local} td #{language.own} - td #{language.english} + unless (curr839 == "en") + td #{language.english} td.prog unless (language.iso == curr839) div.progress(class="open") div.progress-inner(style="width:"+w+"%")(class="open")   + print #{Math.round(w)+"%"} else div.progress(class="closed") div.progress-inner(style="width:"+w+"%")(class="closed")   + print #{Math.round(w)+"%"} td #{language.count} / #{translation.en.count} h4 #{credits} #{thanks} From 17e9e7361767f02117c4cb436925e4660324cc86 Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sun, 21 Apr 2013 16:12:14 +0000 Subject: [PATCH 14/14] use true translation metrics We were on magnetic translation befoe --- modules/project/project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/project/project.js b/modules/project/project.js index 5d6c3a7..59a2fbe 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -52,7 +52,7 @@ var project = function(dbot) { } } var t = {}; - for (var k = 0; k < str.length; k++) { + for (var k = 0; k < translation.length; k++) { var curr = translation[k]; if (t[curr]) { t[curr]["count"] += 1;