Implement template-switching.
Point testing subdomain to port 1111. Fix busted <div>
This commit is contained in:
parent
4ce13cad00
commit
1b32206a23
|
@ -1,3 +1,7 @@
|
|||
undercover.cafe
|
||||
testing.undercover.cafe {
|
||||
reverse_proxy :1111
|
||||
}
|
||||
|
||||
undercover.cafe {
|
||||
reverse_proxy :8080
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div
|
||||
<div>
|
||||
{% block content %}
|
||||
{{ content }}
|
||||
{% endblock content %}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<form method=post id="letter-form">
|
||||
<dl>
|
||||
{% if username %}
|
||||
{{ render_field(form.letterName) }}
|
||||
{{ render_field(form.letterName, onchange="window.location = '/?letter_name=' + this.options[this.value - 1].label") }}
|
||||
{% endif %}
|
||||
{{ render_field(form.username) }}
|
||||
{{ render_field(form.company) }}
|
||||
|
|
Loading…
Reference in New Issue