Merge branch 'feature-display-repo-and-milestone-name' of git://github.com/jhnns/github-burndown-chart into jhnns-feature-display-repo-and-milestone-name

This commit is contained in:
Radek Stepan 2013-10-04 23:18:18 +01:00
commit 46d639b23e
5 changed files with 21 additions and 8 deletions

View File

@ -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

View File

@ -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 }

View File

@ -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,6 +62,14 @@ h2
font-size: 20px
text-transform: uppercase
h2
margin: 0
padding: 0 20px 20px
p
margin: 0
padding: 0 20px
// where D3 renders to
#graph
height: 200px
@ -162,6 +170,7 @@ h2
h2
margin: 10px 0 0 0
padding: 0
&.closed
float: left

View File

@ -1,5 +1,8 @@
<div class="box">
<h1><%- @name %></h2>
<h1><%- @repo %><br><%- @milestone.title %></h1>
<% if @milestone.description: %>
<p><%- @milestone.description %></p>
<% end %>
<div id="graph">
<div id="tooltip"></div>
<div id="svg"></div>

View File

@ -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