Merge pull request #85 from sym3tri/update-templates

static: update all static templates to be generic & prettier
This commit is contained in:
Ed Rooth 2015-08-25 14:56:40 -07:00
commit 8cfffcc98a
10 changed files with 459 additions and 466 deletions

View file

@ -1,13 +1,10 @@
<html> <html>
<body> <body>
Hello! Hello!
<br/>
Welcome to Tectonic! Please verify that your email is {{ .email }} by clicking here: Please verify that your email is {{ .email }} by clicking here:
<br/>
<br/>
<a href="{{ .link }}">Click here to verify!</a> <a href="{{ .link }}">Click here to verify!</a>
Love,
Your Pals at CoreOS
</body> </body>
</html> </html>

View file

@ -1,9 +1,5 @@
Hello! Hello!
Welcome to Tectonic! Please verify that your email is {{ .email }} by clicking here: Please verify that your email is {{ .email }} by clicking here:
{{ .link }} {{ .link }}
Love,
Your Pals at CoreOS

3
static/html/footer.html Normal file
View file

@ -0,0 +1,3 @@
</div>
</body>
</html>

214
static/html/header.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,35 +1,47 @@
<html> {{ template "header.html" }}
<div class="panel">
<h2 class="heading">Create Your Account</h2>
<body>
{{ if .Error }} {{ if .Error }}
<div> <div class="error-box">{{ .Message }}</div>
{{ .Message }}
</div>
{{ else }} {{ else }}
<ul>
{{ range $fe := .FormErrors }}
<li>{{ $fe.Field }}: {{ $fe.Error }} </li>
{{ end }}
</ul>
<h2>Please Register </h2>
<form id="registerForm" method="POST" action="/register"> <form id="registerForm" method="POST" action="/register">
<label for="email">Email</label>
<input type="text" name="email" value="{{.Email}}" />
<br>
<!-- The client side should be responsible for making sure password is entered correctly twice --> <div class="form-row">
<div class="input-desc">
<label for="email">Email Address</label>
</div>
<input id="email" class="input-box" type="text" name="email" required placeholder="email" value="{{.Email}}" autofocus />
{{ range $fe := .FormErrors }}
{{ if eq $fe.Field "email" }}
<div class="error-box-field">{{ $fe.Error }}</div>
{{ end }}
{{ end }}
</div>
{{ if .Local }} {{ if .Local }}
<div class="form-row">
<div class="input-desc">
<label for="password">Password</label> <label for="password">Password</label>
<input type="text" name="password" value="{{.Password}}" /> </div>
<br> <input minlength="6" required id="password" name="password" type="password" class="input-box" value="{{.Password}}"/>
{{ range $fe := .FormErrors }}
{{ if eq $fe.Field "password" }}
<div class="error-box-field">{{ $fe.Error }}</div>
{{ end }}
{{ end }}
</div>
{{ end }} {{ end }}
<button type="submit" class="btn btn-primary">Create Account</button>
<input type="hidden" name="code" value="{{.Code}}"/> <input type="hidden" name="code" value="{{.Code}}"/>
<input type="hidden" name="validate" value="1"/> <input type="hidden" name="validate" value="1"/>
<button>Submit</submit>
</form> </form>
{{ end }} {{ end }}
</body>
</html> </div>
{{ template "footer.html" }}

View file

@ -1,28 +1,74 @@
<html> {{ template "header.html" }}
<body>
<div class="panel">
{{ if .Success }} {{ if .Success }}
Yay, you changed your password! <h2 class="heading">Your password has been reset</h2>
{{ else }} {{ else }}
{{ $lenError := len .Error }} {{ $lenError := len .Error }}
{{ $hasError := ne $lenError 0 }} {{ $hasError := ne $lenError 0 }}
{{ if .DontShowForm }}
{{ if $hasError }} {{ if $hasError }}
<h3> <div class="heading">{{ .Error }}</div>
{{ .Error }} <div class="error-box">{{ .Message }}</div>
</h3> {{ end }}
<div> {{ else }}
{{ .Message }} <h2 class="heading">Reset your password</h2>
<form onsubmit="return validate();" id="resetPasswordForm" method="POST" action="/reset-password">
<div class="form-row">
<div class="input-desc">
<label for="password">New Password</label>
</div>
<input minlength="6" required class="input-box" type="password" id="password" name="password" autofocus />
</div>
<div class="form-row">
<div class="input-desc">
<label for="password-confirm">Confirm New Password</label>
</div>
<input minlength="6" required class="input-box" type="password" id="password-confirm" name="password-confirm" />
</div>
<div id="js-error" style="display: none;" class="error-box">Passwords do not match</div>
{{ if $hasError }}
<div class="form-row">
<div class="error-box">{{ .Error }}</div>
<div class="explain">{{ .Message }}</div>
</div> </div>
{{ end }} {{ end }}
{{ if not .DontShowForm }} <button type="submit" class="btn btn-tec">Reset</button>
<form id="resetPasswordForm" method="POST" action="/reset-password">
<label for="password">Password</label>
<input type="password" name="password" value="" />
<br/>
<button>Submit</button>
<input type="hidden" name="token" value="{{ .Token }}" /> <input type="hidden" name="token" value="{{ .Token }}" />
</form> </form>
{{ end }} {{ end }}
{{ end }} {{ end }}
<body>
</html> </div>
<script>
function validate() {
var p1 = document.getElementById('password'),
p2 = document.getElementById('password-confirm'),
valid = p1 && p2 && p1.value === p2.value;
if (valid) {
hideError();
} else {
showError();
}
return valid;
}
function hideError() {
var e = document.getElementById('js-error');
e.style.display = 'none';
}
function showError() {
var e = document.getElementById('js-error');
e.style.display = 'block';
}
</script>
{{ template "footer.html" }}

View file

@ -1,30 +1,37 @@
<html> {{ template "header.html" }}
<body> <div class="panel">
{{ if .EmailSent }} {{ if .EmailSent }}
<h1>Thank you, please check your email!</h1> <h2 class="heading">Thank you, please check your email!</h2>
<div class="explain">
{{ .Email }} has been sent an email with instructions to reset your password. {{ .Email }} has been sent an email with instructions to reset your password.
</div>
{{ else }} {{ else }}
{{ if .Error }} <h2 class="heading">Reset your password </h2>
<div> <div class="explain">We will send you an email with a link to reset your password.</div>
{{ .Message }}
<form id="sendResetPasswordForm" method="POST" action="/send-reset-password">
<div class="form-row">
<div class="input-desc">
<label for="email">Email Address</label>
</div> </div>
<input required id="email" class="input-box" type="text" name="email" placeholder="email" value="" autofocus />
</div>
{{ if .Error }}
<div class="error-box">{{ .Message }}</div>
{{ end }} {{ end }}
<h2>Reset Your Password </h2> <button type="submit" class="btn btn-primary">Send Reset Link</button>
<P>We will send you an email with a link to reset your password.</p>
<form id="sendResetPasswordForm" method="POST" action="/send-reset-password">
<label for="email">Email</label>
<input type="text" name="email" value="" />
<br/>
<button>Submit</button>
<input type="hidden" name="redirect_uri" value="{{ .RedirectURL }}" /> <input type="hidden" name="redirect_uri" value="{{ .RedirectURL }}" />
<input type="hidden" name="client_id" value="{{ .ClientID }}" /> <input type="hidden" name="client_id" value="{{ .ClientID }}" />
</form> </form>
{{ end }}
</body> {{ end }}
</html> </div>
{{ template "footer.html" }}

View file

@ -1,10 +1,8 @@
<html> {{ template "header.html" }}
<body>
<h3> <div class="panel">
{{ .Error }} <h2 class="heading">{{ .Error }}</h2>
</h3> <div class="explain">{{ .Message }}</div>
<div>
{{ .Message }}
</div> </div>
<body>
</html> {{ template "footer.html" }}