From 879ba366ab689f185df4ccb8777ce5bbcacba72f Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 16 Apr 2012 14:47:07 +0200 Subject: [PATCH] Improved error handling of ticket creation. --- .../app/controllers/agent_ticket_create.js.coffee | 8 ++++++-- app/controllers/tickets_controller.rb | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee index 44be7db59..fd2f5c0b1 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee @@ -87,12 +87,13 @@ class Index extends App.Controller # find sender_id sender = App.TicketArticleSender.findByAttribute("name", "Customer") type = App.TicketArticleType.findByAttribute("name", "phone") - group = App.Group.find(params.group_id) + if params.group_id + group = App.Group.find(params.group_id) # create article params['article'] = { from: params.customer_id_autocompletion, - to: group.name, + to: (group && group.name) || '', subject: params.subject, body: params.body, ticket_article_type_id: type.id, @@ -127,6 +128,9 @@ class Index extends App.Controller # create new create screen @render() + + # scroll to top + window.scrollTo(0,0) error: => @log 'save failed!' diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 0c6b9cc3d..7bf96cb92 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -1,4 +1,5 @@ class TicketsController < ApplicationController + skip_before_filter :verify_authenticity_token before_filter :authentication_check # GET /tickets