2022-09-23 18:55:45 -04:00
|
|
|
{% extends "base.jinja2" %}
|
2022-10-02 15:09:16 -04:00
|
|
|
{% from "_formhelpers.jinja2" import render_field, render_label, render_input %}
|
2022-09-22 11:05:17 -04:00
|
|
|
|
2022-09-23 18:55:45 -04:00
|
|
|
{% block title %}UnderCover{% endblock %}
|
2022-09-22 16:23:01 -04:00
|
|
|
|
2022-09-23 18:55:45 -04:00
|
|
|
{% block head %}
|
2021-07-24 14:51:13 -04:00
|
|
|
<script type="text/javascript">
|
2022-09-22 16:23:01 -04:00
|
|
|
window.onload = () => {
|
2022-09-24 17:20:38 -04:00
|
|
|
{% if letter_errors %}
|
2021-07-28 18:43:19 -04:00
|
|
|
window.scrollTo(0, document.body.scrollHeight);
|
|
|
|
{% endif %}
|
2022-09-22 16:23:01 -04:00
|
|
|
|
2022-09-29 13:02:09 -04:00
|
|
|
{% if not username %}
|
|
|
|
if (window.location.search.includes("reset=true")) {
|
|
|
|
window.history.pushState({}, document.title, window.location.pathname);
|
|
|
|
return;
|
2022-09-23 09:22:27 -04:00
|
|
|
}
|
2022-09-29 13:02:09 -04:00
|
|
|
const cookies = decodeURIComponent(document.cookie)
|
|
|
|
.split(';')
|
|
|
|
.map(cookie => cookie.trim().split('='))
|
|
|
|
cookies.forEach(([id, value]) => {
|
|
|
|
if (!id || !value) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
const e = document.getElementById(id)
|
|
|
|
if (e) {
|
|
|
|
e.value = value
|
|
|
|
}
|
|
|
|
})
|
|
|
|
{% endif %}
|
2021-07-24 14:51:13 -04:00
|
|
|
}
|
2022-09-22 16:23:01 -04:00
|
|
|
|
|
|
|
const clearErrors = () => {
|
2022-09-24 17:20:38 -04:00
|
|
|
const e = document.getElementById('letter_errors')
|
2022-09-29 13:31:58 -04:00
|
|
|
e?.parentNode.removeChild(e)
|
2022-09-22 16:23:01 -04:00
|
|
|
}
|
2021-07-24 14:51:13 -04:00
|
|
|
</script>
|
2022-09-23 18:55:45 -04:00
|
|
|
{% endblock head %}
|
2022-09-22 11:05:17 -04:00
|
|
|
|
2022-09-23 18:55:45 -04:00
|
|
|
{% block content %}
|
2022-09-23 09:22:27 -04:00
|
|
|
<form method=post id="letter-form">
|
2022-09-22 11:05:17 -04:00
|
|
|
<dl>
|
2022-09-25 23:39:58 -04:00
|
|
|
{% if username %}
|
2022-09-29 12:35:26 -04:00
|
|
|
<div class="field">
|
|
|
|
{{ render_label(form.letterName) }}
|
|
|
|
<div style="display: flex; flex-direction: row;">
|
|
|
|
{{ render_input(
|
|
|
|
form.letterName,
|
|
|
|
onchange="window.location = '/?letter_name=' + this.options[this.value - 1].label"
|
|
|
|
)
|
|
|
|
}}
|
2023-10-29 21:16:11 -04:00
|
|
|
<div class="btn secondary color-fade" style="display: flex; justify-content: center; align-items: center; padding-left: 0.75em; padding-right: 0.75em; margin-left: 0.5em;">
|
|
|
|
<a
|
|
|
|
href="/add_letter"
|
|
|
|
style="text-decoration: none; margin: 0; padding: 0;"
|
|
|
|
> + </a>
|
|
|
|
</div>
|
2022-09-29 12:35:26 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-09-25 21:33:09 -04:00
|
|
|
{% endif %}
|
2022-09-22 11:05:17 -04:00
|
|
|
{{ render_field(form.username) }}
|
|
|
|
{{ render_field(form.company) }}
|
2022-09-22 16:55:49 -04:00
|
|
|
{{ render_field(form.jobAndPronoun) }}
|
|
|
|
{{ render_field(form.skillTypes) }}
|
|
|
|
{{ render_field(form.mySkills) }}
|
2022-09-22 11:05:17 -04:00
|
|
|
{{ render_field(form.body, 'class=bigtext') }}
|
2022-09-22 16:55:49 -04:00
|
|
|
{{ render_field(form.closingText) }}
|
2022-09-22 11:05:17 -04:00
|
|
|
</dl>
|
2022-09-22 16:23:01 -04:00
|
|
|
|
2022-09-24 17:20:38 -04:00
|
|
|
{% if letter_errors %}
|
|
|
|
<div id=letter_errors>
|
2022-09-22 16:23:01 -04:00
|
|
|
<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>
|
2022-09-24 17:20:38 -04:00
|
|
|
<p class=letter_errors>
|
|
|
|
{% for error in letter_errors %}
|
2022-09-22 16:23:01 -04:00
|
|
|
{{ error }}<br>
|
|
|
|
{% endfor %}
|
|
|
|
</p>
|
|
|
|
</div>
|
2022-09-22 11:05:17 -04:00
|
|
|
{% endif %}
|
2022-09-22 16:23:01 -04:00
|
|
|
|
2022-09-29 13:28:25 -04:00
|
|
|
<div style="text-align: right; margin-bottom: 2em;">
|
|
|
|
<a href="javascript:void(0)"
|
|
|
|
class="wipe up-wipe"
|
2022-10-02 09:49:24 -04:00
|
|
|
style="margin-bottom: 1em;"
|
2022-09-29 13:31:58 -04:00
|
|
|
onclick="clearErrors();document.getElementById('letter-form').submit()"
|
2022-09-29 13:28:25 -04:00
|
|
|
>Generate PDF</a>
|
|
|
|
</div>
|
2022-09-22 11:05:17 -04:00
|
|
|
</form>
|
2022-09-23 18:55:45 -04:00
|
|
|
{% endblock content %}
|