UnderCover/undercover/templates/writing.jinja2

105 lines
3.1 KiB
Django/Jinja

<!doctype html>
<html lang="en">
<head>
<title>UnderCover</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles_min.css') }}">
<link rel="icon" href="{{ url_for('static', filename='favicon.png') }}" />
<meta name="viewport" content="user-scalable=no; width=device-width">
<script type="text/javascript">
window.onload = () => {
{% if errors %}
window.scrollTo(0, document.body.scrollHeight);
{% endif %}
if (window.location.search.includes("reset=true")) {
window.history.pushState({}, document.title, window.location.pathname);
return;
}
decodeURIComponent(document.cookie).split(';').forEach(cookie => {
[id, value] = cookie.trim().split('=')
if (!id || !value) {
return
}
const e = document.getElementById(id)
if (e) {
e.value = value
}
})
}
const clearErrors = () => {
const e = document.getElementById('errors')
e.parentNode.removeChild(e)
}
</script>
</head>
<body>
<a href="/" style="text-decoration: none;">
<h1><span class="logo left">Under</span><span class="logo right">Cover</span></h1>
</a>
<h2>The secret cover letter generator</h2>
{% if username %}
<div class="user logged-in">
<p>You are logged in as {{ username }}</p>
<form action="/logout">
<input type="submit" value="Logout">
</form>
</div>
{% else %}
<div class="user logged-out">
<p>You are here as a guest.</p>
<form action="/login">
<label for="username">Username: </label>
<input id="username" maxlength="32" minlength="4" name="username" type="text" placeholder="sagev9000">
<label for="password">Password: </label>
<input id="password" maxlength="32" minlength="4" name="password" type="password">
<input type="submit" value="Logout">
</form>
</div>
{% endif %}
{% from "_formhelpers.jinja2" import render_field %}
<form method=post id="letter-form">
<dl>
{{ render_field(form.username) }}
{{ render_field(form.company) }}
{{ render_field(form.jobAndPronoun) }}
{{ render_field(form.skillTypes) }}
{{ render_field(form.mySkills) }}
{{ render_field(form.body, 'class=bigtext') }}
{{ render_field(form.closingText) }}
</dl>
{% if errors %}
<div id=errors>
<h3>Your letter has errors.</h3>
<p>
There is likely a typo in one of your variables (the {\blabla} bits).<br>
Make sure each is spelled correctly, and has the correct brackets on either side
</p>
<p class=errors>
{% for error in errors %}
{{ error }}<br>
{% endfor %}
</p>
</div>
{% endif %}
<a href="javascript:void(0)"
class="wipe up-wipe"
{% if errors %}
onclick="clearErrors();document.getElementById('letter-form').submit()"
{% else %}
onclick="document.getElementById('letter-form').submit()"
{% endif %}
>Generate PDF</a>
</form>
</body>
</html>