forked from imjasonh/nopullrequests
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtemplates.go
51 lines (46 loc) · 1.71 KB
/
templates.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
package main
import "html/template"
var userTmpl = template.Must(template.New("user").Parse(`<html><head>
<title>No Pull Requests</title>
<link rel="stylesheet" href="/static/style.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/2.2.0/octicons.css" />
</head><body><div id="container">
<h1><span class="mega-octicon octicon-git-pull-request"></span>
GitHub Pull Request Rejection Bot</h1>
<ul><form>
{{range .}}
<li><span class="octicon octicon-repo"></span>
<a href="https://github.com/{{.Repo.Owner.Login}}/{{.Repo.Name}}">
{{.Repo.Owner.Login}} / <b>{{.Repo.Name}}</b></a>
{{if .Disabled}}
<button id="enable" type="submit" formaction="/enable/{{.Repo.Owner.Login}}/{{.Repo.Name}}" formmethod="POST">
<span class="octicon octicon-git-pull-request"></span>
Re-enable pull requests
</button>
{{else}}
<button id="disable" type="submit" formaction="/disable/{{.Repo.Owner.Login}}/{{.Repo.Name}}" formmethod="POST">
<span class="octicon octicon-stop"></span>
Disable pull requests
</button>
{{end}}
</li>
{{end}}
</form></ul>
<h3><a href="/">« Home</a></h3>
</div><small>This project is not affiliated with GitHub.com.</small>
<form id="revoke" action="/revoke" method="POST">
<a href="javascript:{}" onclick="document.getElementById('revoke').submit();">Revoke access</a>
</form>
</body>
</html>`))
var errorTmpl = template.Must(template.New("error").Parse(`<html><head>
<title>Oh noes!!1!</title>
<link rel="stylesheet" href="/static/style.css" />
</head><body><div id="container">
<h1>Oh noes!!1!</h1>
<h3>Something went wrong.</h3>
<p>{{.}}</p>
<h3><a href="/">« Home</a></h3>
</div><small>This project is not affiliated with GitHub.com.</small>
</body>
</html>`))