Rename .html files to .jinja2.

Add <title> to main page.
Small style tweaks.
This commit is contained in:
Sage Vaillancourt 2022-09-22 16:11:26 -04:00
parent a032d0577f
commit 17ab611e9c
5 changed files with 11 additions and 10 deletions

View File

@ -2,6 +2,7 @@
<html lang="en">
<head>
<title>UnderCover</title>
<link rel="stylesheet" type="text/css" href="
{{ url_for('static', filename='styles_min.css') }}">
<meta name="viewport" content="user-scalable=no;width=device-width">
@ -28,7 +29,7 @@
<h1><span class="logo left">Under</span><span class="logo right">Cover</span></h1>
<a>
<h2>The secret cover letter generator</h2>
{% from "_formhelpers.html" import render_field %}
{% from "_formhelpers.jinja2" import render_field %}
<form method=post>
<dl>
{{ render_field(form.username) }}
@ -54,7 +55,7 @@
{% endif %}
<input class=submit type=submit value="Generate PDF"
{% if errors %}
onclick="var e = document.getElementById('errors'); e.parentNode.removeChild(e);"
onclick="const e = document.getElementById('errors'); e.parentNode.removeChild(e);"
{% endif %}
>
</form>

View File

@ -25,7 +25,7 @@ base_tex_text = open(proj_dir + "/writing_templates/base.tex", "r").read()
@dataclass
class CLData():
class CLData:
username: str
company: str
jobandpronoun: str
@ -55,7 +55,7 @@ class CLData():
f.write(base_tex_text)
f.close()
output_arg="-jobname=outputs/" + unique_id + " " + unique_file
output_arg = "-jobname=outputs/" + unique_id + " " + unique_file
com = "pdflatex -halt-on-error " + output_arg
build_text = "[" + get_datetime() + "] Building for " + unique_id + " "
result = subprocess.run(
@ -94,7 +94,7 @@ class CLData():
errors = list(map(str.strip, result.stdout.split("\n")))
del errors[:13]
del errors[-2:]
return (None, errors)
return None, errors
def cleanup(unique):

4
start
View File

@ -2,14 +2,14 @@
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then
if ! $SCRIPT_DIR/init; then
if ! "$SCRIPT_DIR/init"; then
exit 1
fi
fi
if ! pip3 -V | grep "$SCRIPT_DIR/.venv"; then
echo "Entering virtual environment..."
source $SCRIPT_DIR/.venv/bin/activate
source "$SCRIPT_DIR/.venv/bin/activate"
fi
if [[ "$1" == "prod" ]]; then

View File

@ -66,7 +66,7 @@ class CLForm(Form):
def index_get():
if flaskr.INDEX is None:
flaskr.INDEX = render_template(
'writing.html',
'writing.jinja2',
form=CLForm()
)
return flaskr.INDEX
@ -115,7 +115,7 @@ def index_post():
(resp, errors) = data.generate_pdf()
if errors:
resp = make_response(render_template(
'writing.html',
'writing.jinja2',
form=form,
errors=errors,
))
@ -125,6 +125,6 @@ def index_post():
return resp
return render_template(
'writing.html',
'writing.jinja2',
form=form,
)