From 0e1f1a28b53451835cc87a74bf93530c65c55145 Mon Sep 17 00:00:00 2001 From: jhnns Date: Fri, 4 Oct 2013 19:25:36 +0200 Subject: [PATCH 1/3] add repo and milestone name and milestone description if present --- src/modules/repo.coffee | 2 +- src/styles/app.styl | 3 +++ src/templates/graph.eco | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/repo.coffee b/src/modules/repo.coffee index 777442b..76280b6 100644 --- a/src/modules/repo.coffee +++ b/src/modules/repo.coffee @@ -59,7 +59,7 @@ module.exports = (opts, cb) -> ) ], (err, values) -> # Render the body. - render 'body', 'graph', name: opts.repo + render 'body', 'graph', { repo: opts.path, milestone: opts.milestone } # Render the progress. render '#progress', 'progress', { progress } diff --git a/src/styles/app.styl b/src/styles/app.styl index c978bef..5778262 100644 --- a/src/styles/app.styl +++ b/src/styles/app.styl @@ -62,6 +62,9 @@ h2 font-size: 20px text-transform: uppercase + p + margin: 0 20px 20px + // where D3 renders to #graph height: 200px diff --git a/src/templates/graph.eco b/src/templates/graph.eco index 392a3b7..e8669bf 100644 --- a/src/templates/graph.eco +++ b/src/templates/graph.eco @@ -1,5 +1,8 @@
-

<%- @name %>

+

<%- @repo %>
<%- @milestone.title %>

+ <% if @milestone.description: %> +

<%- @milestone.description %>

+ <% end %>
From 502601123b0885d50fc87602adb5c3a7821e6584 Mon Sep 17 00:00:00 2001 From: jhnns Date: Fri, 4 Oct 2013 19:47:00 +0200 Subject: [PATCH 2/3] fix margins and paddings --- src/styles/app.styl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/styles/app.styl b/src/styles/app.styl index 5778262..9167604 100644 --- a/src/styles/app.styl +++ b/src/styles/app.styl @@ -38,8 +38,8 @@ h2 // different classes thereof &.generic, &.info, &.error, &.success + padding: 20px 0 border-top: 4px solid #EAC85D - padding: 20px width: 50% margin: 0 auto @@ -62,8 +62,13 @@ h2 font-size: 20px text-transform: uppercase + h2 + margin: 0 + padding: 0 20px 20px + p - margin: 0 20px 20px + margin: 0 + padding: 0 20px // where D3 renders to #graph @@ -165,6 +170,7 @@ h2 h2 margin: 10px 0 0 0 + padding: 0 &.closed float: left From 882344b0cb778f7d101837315421f74a4bb5c965 Mon Sep 17 00:00:00 2001 From: jhnns Date: Fri, 4 Oct 2013 19:47:46 +0200 Subject: [PATCH 3/3] provide better error messages --- src/modules/milestones.coffee | 4 ++-- test/milestones.coffee | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/milestones.coffee b/src/modules/milestones.coffee index d8e3808..f3abb66 100644 --- a/src/modules/milestones.coffee +++ b/src/modules/milestones.coffee @@ -11,10 +11,10 @@ module.exports = # GitHub errors? return cb data.message if data.message # Empty warning? - return cb null, 'No open milestones for repo' unless data.length + return cb null, "No open milestones for repo #{repo.path}" unless data.length # The first milestone should be ending soonest. m = data[0] # Empty milestone? - return cb null, 'No issues for milestone' if m.open_issues + m.closed_issues is 0 + return cb null, "No issues for milestone #{m.title}" if m.open_issues + m.closed_issues is 0 cb null, null, m \ No newline at end of file diff --git a/test/milestones.coffee b/test/milestones.coffee index eb4f17b..79dea0d 100644 --- a/test/milestones.coffee +++ b/test/milestones.coffee @@ -55,9 +55,9 @@ module.exports = req.all_milestones = (opts, cb) -> cb null, [] - milestones.get_current {}, (err, warn, milestone) -> + milestones.get_current { path: 'some/repo' }, (err, warn, milestone) -> assert.ifError err - assert.equal warn, 'No open milestones for repo' + assert.equal warn, 'No open milestones for repo some/repo' do done 'milestones - get current when not found': (done) -> @@ -72,6 +72,7 @@ module.exports = req.all_milestones = (opts, cb) -> cb null, [ { + 'title': 'No issues' 'number': 1 'created_at': '2013-01-01T00:00:00Z' 'due_on': '2013-02-01T00:00:00Z', @@ -82,5 +83,5 @@ module.exports = milestones.get_current {}, (err, warn, milestone) -> assert.ifError err - assert.equal warn, 'No issues for milestone' + assert.equal warn, 'No issues for milestone No issues' do done \ No newline at end of file