handle markdown in descriptions

This commit is contained in:
Radek Stepan 2013-10-04 23:42:54 +01:00
parent 46d639b23e
commit e4056d1cb0
9 changed files with 1138 additions and 17 deletions

View File

@ -516,6 +516,7 @@ table {
left: 85%;
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
@ -571,8 +572,8 @@ h2 {
.box.info,
.box.error,
.box.success {
padding: 20px 0;
border-top: 4px solid #eac85d;
padding: 20px;
width: 50%;
margin: 0 auto;
}
@ -595,6 +596,17 @@ h2 {
font-size: 20px;
text-transform: uppercase;
}
.box h2 {
margin: 0;
padding: 0 20px 20px;
}
.box p {
margin: 0;
padding: 0 20px;
}
.box p.description {
margin-top: -10px;
}
#graph {
height: 200px;
position: relative;
@ -679,6 +691,7 @@ h2 {
}
#progress h2 {
margin: 10px 0 0 0;
padding: 0;
}
#progress h2.closed {
float: left;

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,8 @@
"request": "~2.27.0"
},
"devDependencies": {
"mocha": "~1.12.0"
"mocha": "~1.12.0",
"marked": "~0.2.9"
},
"scripts": {
"test": "make test"

View File

@ -9,7 +9,8 @@
"visionmedia/superagent": "*",
"necolas/normalize.css": "*",
"component/tip": "*",
"component/aurora-tip": "*"
"component/aurora-tip": "*",
"component/marked": "*"
},
"scripts": [
"app.coffee",

View File

@ -1,4 +1,6 @@
#!/usr/bin/env coffee
marked = require 'marked'
request = require './request'
module.exports =
@ -16,5 +18,7 @@ module.exports =
m = data[0]
# Empty milestone?
return cb null, "No issues for milestone #{m.title}" if m.open_issues + m.closed_issues is 0
# Has description? Parse GFM.
m.description = marked(m.description)[3...-5] if m.description
cb null, null, m

View File

@ -59,7 +59,7 @@ module.exports = (opts, cb) ->
)
], (err, values) ->
# Render the body.
render 'body', 'graph', { repo: opts.path, milestone: opts.milestone }
render 'body', 'graph', { 'repo': opts.path, 'milestone': opts.milestone }
# Render the progress.
render '#progress', 'progress', { progress }

View File

@ -70,6 +70,9 @@ h2
margin: 0
padding: 0 20px
&.description
margin-top: -10px
// where D3 renders to
#graph
height: 200px

View File

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

View File

@ -84,4 +84,22 @@ module.exports =
milestones.get_current {}, (err, warn, milestone) ->
assert.ifError err
assert.equal warn, 'No issues for milestone No issues'
do done
'milestones - has description': (done) ->
marked = require 'marked'
req.all_milestones = (opts, cb) ->
cb null, [
{
'number': 1
'created_at': '2013-01-01T00:00:00Z'
'due_on': '2013-02-01T00:00:00Z'
'description': 'A description of this <strong>milestone</strong> goes *here*'
}
]
milestones.get_current {}, (err, warn, milestone) ->
assert.ifError err
assert.equal milestone.description, 'A description of this <strong>milestone</strong> goes <em>here</em>'
do done