-
Notifications
You must be signed in to change notification settings - Fork 2
/
pages.go
253 lines (213 loc) · 7.56 KB
/
pages.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
package main
var base = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>GoBlog</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/paper/bootstrap.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</head>
<body>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">GoBlog</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li {{if not .User}}class="hidden"{{end}}{{if eq .PageName "admin" }}class="active"{{end}}><a href="/admin">Admin</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li {{if not .User}}class="hidden"{{end}}> <a href="/admin">{{if .User}}{{.User}}{{end}}</a> </li>
<li {{if not .User}}class="hidden"{{end}}> <a href="/logout">Log Out</a> </li>
<li {{if .User}}class="hidden"{{end}} {{if eq .PageName "signup" }}class="active"{{end}}><a href="/signup">Sign Up</a></li>
<li {{if .User}}class="hidden"{{end}} class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Sign in <b class="caret"></b></a>
<ul class="dropdown-menu" style="padding: 15px;min-width: 250px;">
<li>
<div class="row">
<div class="col-md-12">
<form class="form" role="form" method="post" action="/login/" accept-charset="UTF-8" id="login-nav">
<div class="form-group">
<label class="sr-only" for="email">Email address</label>
<input type="email" class="form-control" name="email" id="email" placeholder="Email address" required>
</div>
<div class="form-group">
<label class="sr-only" for="password">Password</label>
<input type="password" class="form-control" name="password" id="password" placeholder="Password" required>
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Remember me
</label>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success btn-block">Sign in</button>
</div>
</form>
</div>
</div>
</li>
<ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
{{ template "content" .}}
</body>
</html>
`
var login = `
{{ define "content" }}
<div class="container-fluid">
<div class="page-header">
<h1>Login</h1>
</div>
<form class="form-horizontal" action="/login/" method="POST">
<div class="form-group">
<label for="email" class="col-sm-2 control-label">User name</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="email" name="email" required>
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Password</label>
<div class="col-sm-4">
<input type="password" class="form-control" id="password" name="password" required>
</div>
</div>
<div class="col-sm-6">
<button type="submit" class="btn btn-primary pull-right">Login</button>
</div>
</form>
</div>
{{ end }}
`
var admin = `
{{define "content"}}
{{ if .Blogs }}
<div class="col-md-6 col-md-offset-3">
<div class="list-group">
<div class="list-group-item active">Your Blogs</div>
{{ range .Blogs }}
<a href="http://{{.Website}}" class="list-group-item"> {{.Blogname}} </a>
{{ end }}
</div>
</div>
{{ end }}
<div class="col-md-6 col-md-offset-3">
<form class="form-horizontal" action="/admin/" method="POST">
<fieldset>
<!-- Form Name -->
<legend>Create a new blog</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="blog">Blog Name/Subdomain (.ghost.pw)</label>
<div class="col-md-6">
<input id="blogname" name="blogname" type="text" placeholder="exampleblog" class="form-control input-md" required="">
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-4">
<button id="submit" name="submit" class="btn btn-success">Create Blog</button>
</div>
</div>
</fieldset>
</form>
</div>
{{end}}
`
var signup = `
{{define "content"}}
<div class="col-md-6 col-md-offset-3">
<form class="form-horizontal" action="/signup/" method="POST">
<fieldset>
<!-- Form Name -->
<legend>Sign Up for GoBlog</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">E-mail address</label>
<div class="col-md-6">
<input id="email" name="email" type="email" placeholder="E-mail address" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="password">Password</label>
<div class="col-md-6">
<input id="password" name="password" type="password" placeholder="Password" class="form-control input-md" required="">
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-4">
<button id="submit" name="submit" class="btn btn-success">Sign Me Up!</button>
</div>
</div>
</fieldset>
</form>
</div>
{{end}}
`
var errorPage = `
{{define "content"}}
<div class="col-md-6 col-md-offset-3">
<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
{{.Error}}
</div>
</div>
{{end}}
`
var mainPage = `
{{define "content"}}
<div class="row">
<div class="col-md-5 col-md-offset-1">
<h1>GoBlog</h1>
<h2>Simple Free Blog Hosting</h2>
<hr>
<h3>Deploy your own blog in as little as 15 seconds</h3>
</div>
<div class="col-md-6">
<img src="https://placeholdit.imgix.net/~text?txtsize=100&txt=Animated%20GIF%20goes%20here&w=600&h=500" style="width:100%">
</div>
</div>
<hr>
<div class="row text-center">
<h2>Simple to Set Up</h2>
<div class="col-md-4">
<h3>Easy to Deploy</h3>
<i class="glyphicon glyphicon-ok" style="font-size: 20vw; color: #2196f3"></i>
</div>
<div class="col-md-4">
<h3>Upload a Custom Theme</h3>
<i class="glyphicon glyphicon-cloud-upload" style="font-size: 20vw; color: #2196f3"></i>
</div>
<div class="col-md-4">
<h3>Use Your Own Domain Name</h3>
<i class="glyphicon glyphicon-globe" style="font-size: 20vw; color: #2196f3"></i>
</div>
</div>
{{end}}
`