UnderCover/flaskr/templates/writing.html

89 lines
2.2 KiB
HTML

<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="
{{ url_for('static', filename='styles.css') }}">
<meta name="viewport" content="user-scalable=no">
<script type="text/javascript">
function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for(let i = 0; i <ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function init() {
{% if errors %}
window.scrollTo(0, document.body.scrollHeight);
{% endif %}
if (document.getElementById('company').value === "BananaCorp") {
return
}
cookies = [
'username',
'company',
'jobandpronoun',
'skilltypes',
'myskills',
'closingtext',
'body',
]
for(let i = 0; i < cookies.length; i++) {
c = getCookie(cookies[i]);
if (c) {
document.getElementById(cookies[i]).value=c
}
}
}
window.onload = init;
</script>
</head>
<body>
<h1>UnderCover</h1>
<h2>The secret cover letter generator</h2>
{% from "_formhelpers.html" import render_field %}
<form method=post>
<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 %}
<p><input type=submit value="Submit"
{% if errors %}
onclick="var elem = document.getElementById('errors'); elem.parentNode.removeChild(elem);"
{% endif %}
></p>
</form>
</body>
</html>