-
Notifications
You must be signed in to change notification settings - Fork 206
/
milestones_template.go
75 lines (72 loc) · 2.34 KB
/
milestones_template.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package github
const (
rawMSsvg = `<path d="M8 2H6V0h2v2zm4 5H2c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h10l2 2-2 2zM8 4H6v2h2V4zM6 16h2V8H6v8z"></path>`
openMSsvg = `
<span class="issue-state" title="Open Milestone">
<svg height="16" width="14" version="1.1" viewBox="0 0 14 16">
` + rawMSsvg + `
</svg>
</span>
`
closedMSsvg = `
<span class="issue-state" title="Closed Milestone">
<svg aria-hidden="true" class="octicon octicon-check" height="16" height="14" version="1.1" viewBox="0 0 12 16">
<path d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path>
</svg>
</span>
`
milestonesTemplate = `
<div class="section-github-render">
{{if .HasMilestones}}
<table class="github-table" style="width: 100%;">
<thead>
<tr>
<th class="title">Milestones <span>· {{.ClosedMS}} closed and {{.OpenMS}} open</span>
</th>
<th></th>
</tr>
</thead>
<tbody>
{{range $data := .Milestones}}
<tr>
<td>
{{if $data.IsMilestone}}
{{if $data.IsOpen}}
` + openMSsvg + `
{{else}}
` + closedMSsvg + `
{{end}}
{{end}}
<a class="link" href="{{$data.URL}}">{{$data.Name}}</a>
<span class="data"> · {{if $data.IsMilestone}} {{$data.DueDate}}{{end}} </span>
</td>
<td class="right-column">
{{if $data.IsMilestone}}
<span class="bold color-off-black">{{$data.CompleteMsg}}</span> complete
<span class="bold color-off-black">{{$data.OpenIssues}}</span> open
<span class="bold color-off-black">{{$data.ClosedIssues}}</span> closed
{{else}}
<span class="bold color-off-black">{{$data.OpenIssues}}</span> open <span class="bold color-off-black">{{$data.ClosedIssues}}</span> closed
{{end}}
<div class="progress-bar">
<div class="progress" style="width:{{$data.Progress}}%;"></div>
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
{{end}}
</div>
`
)