Skip to content
Permalink
Browse files

11-Facelift add bootstrap

  • Loading branch information...
bonfy committed Oct 13, 2018
1 parent 4bc0b93 commit ca5ccbaa06d9d4041357979246ed92c031ea722e
@@ -5,20 +5,38 @@
{{else}}
<title>Welcome to blog!</title>
{{end}}

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

<style>
.container {
max-width: 960px;
}
</style>

</head>
<body>
<div>
Blog:
<a href="/">Home</a>
<a href="/explore">Explore</a>
<div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom shadow-sm">
<h5 class="my-0 mr-md-auto font-weight-normal">Blog</h5>
<nav class="my-2 my-md-0 mr-md-3">
<a class="p-2 text-dark" href="/">Home</a>
<a class="p-2 text-dark" href="/explore">Explore</a>
{{if .CurrentUser}}
<a class="p-2 text-dark" href="/user/{{.CurrentUser}}">Profile</a>
{{end}}
</nav>

{{if .CurrentUser}}
<a href="/user/{{.CurrentUser}}">Profile</a>
<a href="/logout">Logout</a>
<a class="btn btn-outline-primary" href="/logout">Logout</a>
{{else}}
<a href="/login">Login</a>
<a class="btn btn-outline-primary" href="/login">Login</a>
{{end}}
</div>

{{template "content" .}}
<div class="container">
{{template "content" .}}
</div>

<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
</body>
</html>
@@ -2,18 +2,45 @@
<h1>Hello, {{.CurrentUser}}!</h1>

{{range .Posts}}
<table>
<table class="table table-hover">
<tr valign="top">
<td><img src="{{.User.Avatar}}&s=36"></td>
<td width="36px"><img src="{{.User.Avatar}}&s=36"></td>
<td><a href="/user/{{.User.Username}}">{{ .User.Username }}</a> says:<br>{{ .Body }}</td>
</tr>
</table>
{{end}}

{{ if gt .PrevPage 0 }}
<a href="/explore?page={{.PrevPage}}">Newer posts</a>
{{ end }}
{{ if gt .NextPage 0 }}
<a href="/explore?page={{.NextPage}}">Older posts</a>
{{ end }}
<nav aria-label="...">
<ul class="pagination justify-content-center">
{{ if gt .PrevPage 0 }}
<li class="page-item">
<a href="/explore?page={{.PrevPage}}">
<span class="page-link" aria-hidden="true">&larr; Newer Posts</span>
</a>
</li>
{{ else }}
<li class="page-item disabled">
<a href="#">
<span class="page-link" aria-hidden="true">&larr; Newer Posts</span>
</a>
</li>
{{ end }}

{{ if gt .NextPage 0 }}
<li class="page-item">
<a href="/explore?page={{.NextPage}}">
<span class="page-link" aria-hidden="true">Older Posts &rarr;</span>
</a>
</li>
{{ else }}
<li class="page-item disabled">
<a href="#">
<span class="page-link" aria-hidden="true">Older Posts &rarr;</span>
</a>
</li>
{{ end }}

</ul>
</nav>

{{end}}
@@ -3,8 +3,8 @@ <h1>Hello, {{.CurrentUser}}!</h1>

<form action="/" method="post">

<p><textarea name="body" rows="3" cols="80" value="" placeholder="say something..."></textarea></p>
<p><input type="submit" name="submit" value="Post"></p>
<p><textarea class="form-control" name="body" rows="3" cols="80" value="" placeholder="say something..."></textarea></p>
<p><input class="btn btn-outline-primary" type="submit" name="submit" value="Post"></p>

{{ if .Flash }}
<span style="color: red;">[{{.Flash}}]</span>
@@ -13,19 +13,46 @@ <h1>Hello, {{.CurrentUser}}!</h1>


{{range .Posts}}
<table>
<table class="table table-hover">
<tr valign="top">
<td><img src="{{.User.Avatar}}&s=36"></td>
<td width="36px"><img src="{{.User.Avatar}}&s=36"></td>
<td><a href="/user/{{.User.Username}}">{{ .User.Username }}</a> says:<br>{{ .Body }}</td>
</tr>
</table>
{{end}}


{{ if gt .PrevPage 0 }}
<a href="/?page={{.PrevPage}}">Newer posts</a>
{{ end }}
{{ if gt .NextPage 0 }}
<a href="/?page={{.NextPage}}">Older posts</a>
{{ end }}
<nav aria-label="...">
<ul class="pagination justify-content-center">
{{ if gt .PrevPage 0 }}
<li class="page-item">
<a href="/?page={{.PrevPage}}">
<span class="page-link" aria-hidden="true">&larr; Newer Posts</span>
</a>
</li>
{{ else }}
<li class="page-item disabled">
<a href="#">
<span class="page-link" aria-hidden="true">&larr; Newer Posts</span>
</a>
</li>
{{ end }}

{{ if gt .NextPage 0 }}
<li class="page-item">
<a href="/?page={{.NextPage}}">
<span class="page-link" aria-hidden="true">Older Posts &rarr;</span>
</a>
</li>
{{ else }}
<li class="page-item disabled">
<a href="#">
<span class="page-link" aria-hidden="true">Older Posts &rarr;</span>
</a>
</li>
{{ end }}

</ul>
</nav>

{{end}}
@@ -1,9 +1,9 @@
{{define "content"}}
<h1>Login</h1>
<form action="/login" method="post" name="login">
<p><input type="text" name="username" value="" placeholder="Username or Email"></p>
<p><input type="password" name="password" value="" placeholder="Password"></p>
<p><input type="submit" name="submit" value="Login"></p>
<p><input class="form-control" type="text" name="username" value="" placeholder="Username or Email"></p>
<p><input class="form-control" type="password" name="password" value="" placeholder="Password"></p>
<p><input class="btn btn-outline-primary" type="submit" name="submit" value="Login"></p>
</form>

<p>New User? <a href="/register">Click to Register!</a></p>
@@ -19,9 +19,9 @@ <h1>User: {{.ProfileUser.Username}}</h1>
<p><a href="/profile_edit">Edit your profile</a></p>
{{else}}
{{if .IsFollow}}
<p><a href="/unfollow/{{.ProfileUser.Username}}">Unfollow</a></p>
<p><a class="btn btn-outline-primary" href="/unfollow/{{.ProfileUser.Username}}">Unfollow</a></p>
{{else}}
<p><a href="/follow/{{.ProfileUser.Username}}">Follow</a></p>
<p><a class="btn btn-outline-primary" href="/follow/{{.ProfileUser.Username}}">Follow</a></p>
{{end}}
{{end}}
</td>
@@ -31,19 +31,44 @@ <h1>User: {{.ProfileUser.Username}}</h1>
<hr/>

{{range .Posts}}
<table>
<table class="table table-hover">
<tr valign="top">
<td><img src="{{.User.Avatar}}&s=36"></td>
<td width="36px"><img src="{{.User.Avatar}}&s=36"></td>
<td><a href="/user/{{.User.Username}}">{{ .User.Username }}</a> says:<br>{{ .Body }}</td>
</tr>
</table>
{{end}}

{{ if gt .PrevPage 0 }}
<a href="/user/{{.ProfileUser.Username}}?page={{.PrevPage}}">Newer posts</a>
{{ end }}
{{ if gt .NextPage 0 }}
<a href="/user/{{.ProfileUser.Username}}?page={{.NextPage}}">Older posts</a>
{{ end }}
<nav aria-label="...">
<ul class="pagination justify-content-center">
{{ if gt .PrevPage 0 }}
<li class="page-item">
<a href="/user/{{.ProfileUser.Username}}?page={{.PrevPage}}">
<span class="page-link" aria-hidden="true">&larr; Newer Posts</span>
</a>
</li>
{{ else }}
<li class="page-item disabled">
<a href="#">
<span class="page-link" aria-hidden="true">&larr; Newer Posts</span>
</a>
</li>
{{ end }}
{{ if gt .NextPage 0 }}
<li class="page-item">
<a href="/user/{{.ProfileUser.Username}}?page={{.NextPage}}">
<span class="page-link" aria-hidden="true">Older Posts &rarr;</span>
</a>
</li>
{{ else }}
<li class="page-item disabled">
<a href="#">
<span class="page-link" aria-hidden="true">Older Posts &rarr;</span>
</a>
</li>
{{ end }}

</ul>
</nav>

{{end}}
@@ -3,8 +3,8 @@ <h1>Profile Edit</h1>
<p>Username: {{.ProfileUser.Username}}</p>
<form action="/profile_edit" method="post" name="profile_edit">
<p>About Me</p>
<p><textarea name="aboutme" rows="5" cols="80" value="" placeholder="about me">{{.ProfileUser.AboutMe}}</textarea></p>
<p><input type="submit" name="submit" value="Save"></p>
<p><textarea class="form-control" name="aboutme" rows="5" cols="80" value="" placeholder="about me">{{.ProfileUser.AboutMe}}</textarea></p>
<p><input class="btn btn-outline-primary" type="submit" name="submit" value="Save"></p>
</form>

{{if .Errs}}
@@ -1,11 +1,11 @@
{{define "content"}}
<h1>Register</h1>
<form action="/register" method="post" name="register">
<p><input type="text" name="username" value="" placeholder="Username"></p>
<p><input type="text" name="email" value="" placeholder="Email"></p>
<p><input type="password" name="pwd1" value="" placeholder="Password"></p>
<p><input type="password" name="pwd2" value="" placeholder="Password"></p>
<p><input type="submit" name="submit" value="Register"></p>
<p><input class="form-control" type="text" name="username" value="" placeholder="Username"></p>
<p><input class="form-control" type="text" name="email" value="" placeholder="Email"></p>
<p><input class="form-control" type="password" name="pwd1" value="" placeholder="Password"></p>
<p><input class="form-control" type="password" name="pwd2" value="" placeholder="Password"></p>
<p><input class="btn btn-outline-primary" type="submit" name="submit" value="Register"></p>
</form>

<p>Have account? <a href="/login">Click to Login!</a></p>
@@ -1,9 +1,9 @@
{{define "content"}}
<h1>Register</h1>
<form action="/reset_password/{{.Token}}" method="post" name="reset_password">
<p><input type="password" name="pwd1" value="" placeholder="Password"></p>
<p><input type="password" name="pwd2" value="" placeholder="Confirm Password"></p>
<p><input type="submit" name="submit" value="Reset"></p>
<p><input class="form-control" type="password" name="pwd1" value="" placeholder="Password"></p>
<p><input class="form-control" type="password" name="pwd2" value="" placeholder="Confirm Password"></p>
<p><input class="btn btn-outline-primary" type="submit" name="submit" value="Reset"></p>
</form>


0 comments on commit ca5ccba

Please sign in to comment.
You can’t perform that action at this time.