Improved error handling if type is not existing, use default type. Issue #55.
This commit is contained in:
parent
7072f88d3e
commit
eef2b4df42
1 changed files with 11 additions and 2 deletions
|
@ -16,11 +16,13 @@ class Index extends App.Controller
|
||||||
# set title
|
# set title
|
||||||
@title 'New Ticket'
|
@title 'New Ticket'
|
||||||
@form_id = App.ControllerForm.formId()
|
@form_id = App.ControllerForm.formId()
|
||||||
@navupdate '#ticket_create'
|
|
||||||
|
|
||||||
@edit_form = undefined
|
@edit_form = undefined
|
||||||
|
|
||||||
|
# set article attributes
|
||||||
|
default_type = 'call_inbound'
|
||||||
if !@type
|
if !@type
|
||||||
@type = 'call_inbound'
|
@type = default_type
|
||||||
article_sender_type_map =
|
article_sender_type_map =
|
||||||
call_inbound:
|
call_inbound:
|
||||||
sender: 'Customer'
|
sender: 'Customer'
|
||||||
|
@ -36,6 +38,13 @@ class Index extends App.Controller
|
||||||
title: 'Email'
|
title: 'Email'
|
||||||
@article_attributes = article_sender_type_map[@type]
|
@article_attributes = article_sender_type_map[@type]
|
||||||
|
|
||||||
|
# if no map entry exists, route to default
|
||||||
|
if !@article_attributes
|
||||||
|
@navigate '#ticket_create/' + default_type
|
||||||
|
|
||||||
|
# update navbar highlighting
|
||||||
|
@navupdate '#ticket_create/' + @type
|
||||||
|
|
||||||
@fetch(params)
|
@fetch(params)
|
||||||
|
|
||||||
# lisen if view need to be rerendert
|
# lisen if view need to be rerendert
|
||||||
|
|
Loading…
Reference in a new issue