Redirect to template after succesful branding request

if user entered branding request flow from a template.
This commit is contained in:
Pea Tyczynska
2020-01-23 15:54:13 +00:00
parent fdff9d3b83
commit a578ec23a3
2 changed files with 76 additions and 4 deletions

View File

@@ -1032,8 +1032,8 @@ def link_service_to_organisation(service_id):
@main.route("/services/<uuid:service_id>/branding-request/<branding_type>", methods=['GET', 'POST'])
@user_has_permissions('manage_service')
def branding_request(service_id, branding_type):
form = BrandingOptions(current_service, branding_type=branding_type)
from_template = request.args.get('from_template')
if branding_type == "email":
branding_name = current_service.email_branding_name
elif branding_type == "letter":
@@ -1065,19 +1065,20 @@ def branding_request(service_id, branding_type):
user_name=current_user.name,
tags=['notify_action', 'notify_branding'],
)
flash((
'Thanks for your branding request. Well get back to you '
'within one working day.'
), 'default')
return redirect(url_for('.service_settings', service_id=service_id))
return redirect(url_for(
'.view_template', service_id=current_service.id, template_id=from_template
) if from_template else url_for('.service_settings', service_id=current_service.id))
return render_template(
'views/service-settings/branding/branding-options.html',
form=form,
branding_type=branding_type,
branding_name=branding_name,
from_template=request.args.get('from_template')
from_template=from_template
)