From a61a2300abd0247e6a86331b86359b7e4a58206e Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Fri, 19 Apr 2013 04:28:03 +0000 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 adcd5803b06229289f610f5871659e7dcaa7e6cb Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 20 Apr 2013 17:42:34 +0000 Subject: [PATCH 4/5] 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 5/5] 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){