Refactor check page into 3 separate templates

The check page is a very complex Jinja template. It needs breaking up
to make it easier to understand what’s going on.

I think there are three di
This commit is contained in:
Chris Hill-Scott
2017-07-20 08:59:49 +01:00
parent b003162932
commit ddeed88210
4 changed files with 480 additions and 4 deletions

View File

@@ -447,10 +447,16 @@ def _check_messages(service_id, template_type, upload_id, letters_as_pdf=False):
@login_required
@user_has_permissions('send_texts', 'send_emails', 'send_letters')
def check_messages(service_id, template_type, upload_id):
return render_template(
'views/check.html',
**_check_messages(service_id, template_type, upload_id)
)
data = _check_messages(service_id, template_type, upload_id)
if data['row_errors']:
return render_template('views/check/row-errors.html', **data)
if data['errors']:
return render_template('views/check/column-errors.html', **data)
return render_template('views/check/ok.html', **data)
@main.route("/services/<service_id>/<template_type>/check/<upload_id>.<filetype>", methods=['GET'])