Improvements to iframe workflow

This commit is contained in:
Timothy Hobbs 2020-01-14 17:41:55 +01:00
parent 07a42e07f8
commit cd019d1128
4 changed files with 16 additions and 1 deletions

View File

@ -4,7 +4,7 @@
{% if helpdesk_settings.HELPDESK_SUBMIT_A_TICKET_PUBLIC %}
<p>{% trans "Unless otherwise stated, all fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}</p>
<form method='post' action='./#submit' enctype='multipart/form-data'>
<form method='post' enctype='multipart/form-data'>
{{ form|bootstrap4form }}
<button type="submit" class="btn btn-primary btn-lg btn-block"><i class="fa fa-send"></i>&nbsp;{% trans "Submit Ticket" %}</button>
{% csrf_token %}</form>

View File

@ -0,0 +1,4 @@
{% load i18n %}
<h1>
{% trans "Ticket submitted successfully! We will reply via email as soon as we get the chance." %}
</h1>

View File

@ -171,6 +171,10 @@ urlpatterns += [
public.CreateTicketIframeView.as_view(),
name='submit_iframe'),
url(r'^tickets/success_iframe/$', # Ticket was submitted successfully
public.SuccessIframeView.as_view(),
name='success_iframe'),
url(r'^view/$',
public.view_ticket,
name='public_view'),

View File

@ -107,6 +107,13 @@ class CreateTicketIframeView(BaseCreateTicketView):
def dispatch(self, *args, **kwargs):
return super().dispatch(*args, **kwargs)
def form_valid(self, form):
if super().form_valid(form).status_code == 302:
return HttpResponseRedirect(reverse('helpdesk:success_iframe'))
class SuccessIframeView(TemplateView):
template_name = 'helpdesk/success_iframe.html'
class CreateTicketView(BaseCreateTicketView):