Refactor support ticket into a template

This is the same thing we do for go live requests and branding requests.

It’s easier to do templating logic in a templating language than in
Python.
This commit is contained in:
Chris Hill-Scott
2022-06-07 13:44:58 +01:00
parent 1787f9f42f
commit 197e98d891
2 changed files with 8 additions and 10 deletions

View File

@@ -114,17 +114,10 @@ def feedback(ticket_type):
if form.validate_on_submit():
user_email = form.email_address.data
user_name = form.name.data or None
if current_service:
service_string = 'Service: "{name}"\n{url}\n'.format(
name=current_service.name,
url=url_for('main.service_dashboard', service_id=current_service.id)
)
else:
service_string = ''
feedback_msg = '{}\n{}'.format(
form.feedback.data,
service_string,
feedback_msg = render_template(
'support-tickets/support-ticket.txt',
content=form.feedback.data,
)
ticket = NotifySupportTicket(

View File

@@ -0,0 +1,5 @@
{{ content }}
{% if current_service -%}
Service: "{{ current_service.name }}"
{{ url_for('main.service_dashboard', service_id=current_service.id) }}
{% endif %}