diff --git a/Caddyfile b/Caddyfile index 91d59ba..13d3d2f 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,3 +1,7 @@ -undercover.cafe +testing.undercover.cafe { + reverse_proxy :1111 +} -reverse_proxy :8080 +undercover.cafe { + reverse_proxy :8080 +} diff --git a/undercover/routes.py b/undercover/routes.py index f90eb89..624df0d 100644 --- a/undercover/routes.py +++ b/undercover/routes.py @@ -63,9 +63,9 @@ class CLForm(Form): "My name is {\\username}. I'm excited for the opportunity to work as " "{\\jobAndPronoun} with your company. I think my {\\skillTypes} knowledge " "of {\\mySkills} could contribute well to your team.\n\n" - + "I am passionate about what I do, and I think we would work well together.\n\n" - + "Thank you for your consideration." ) ) @@ -116,11 +116,22 @@ def index_get(): if len(letters) > 0: letter_names = [(i + 1, letter.title) for i, letter in enumerate(letters)] form.letterName.choices = letter_names - # TODO: Load this data more dynamically - # I.e. use a dictionary instead of explicitly-defined fields - data = json.loads(letters[0].contents) form.letterName.data = 1 + selected_letter = request.args.get('letter_name') + if selected_letter: + for i, letter in enumerate(letters): + if letter.title == selected_letter: + form.letterName.data = i + 1 + break + + # TODO: Load this data more dynamically + # I.e. use a dictionary instead of explicitly-defined fields + data = json.loads(letters[form.letterName.data - 1].contents) + + # Ensures default value is set + form.letterName.process_data(form.letterName.data) + form.company.data = data['company'] form.body.data = data['body'] form.closingText.data = data['closingText'] @@ -254,3 +265,4 @@ def generate_pdf(): return resp return render_index(form=form) + diff --git a/undercover/templates/base.jinja2 b/undercover/templates/base.jinja2 index 20543dc..89bee77 100644 --- a/undercover/templates/base.jinja2 +++ b/undercover/templates/base.jinja2 @@ -19,10 +19,11 @@ {{ error }} {% endif %} -