From b8ed5151fbe3100da8e021739adc3a0b29a23cab Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 8 Apr 2017 01:23:09 +0200 Subject: [PATCH] Fixed issue #931 - Template assigned to all new tickets tabs. --- .../javascripts/app/controllers/agent_ticket_create.coffee | 7 ++----- .../javascripts/app/controllers/widget/template.coffee | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index 89ae5f150..80c5fe9f0 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -24,11 +24,6 @@ class App.TicketCreate extends App.Controller @buildScreen(params) @bindId = App.TicketCreateCollection.one(load) - # lisen if view need to be rerendered - @bind 'ticket_create_rerender', (defaults) => - @log 'notice', 'error', defaults - @render(defaults) - # rerender view, e. g. on langauge change @bind 'ui:rerender', => return if !@authenticateCheck() @@ -116,9 +111,11 @@ class App.TicketCreate extends App.Controller show: => @navupdate "#ticket/create/id/#{@id}#{@split}", type: 'menu' @autosaveStart() + @bind('ticket_create_rerender', (template) => @render(template)) hide: => @autosaveStop() + @unbind('ticket_create_rerender', (template) => @render(template)) changed: => formCurrent = @formParam( @$('.ticket-create') ) diff --git a/app/assets/javascripts/app/controllers/widget/template.coffee b/app/assets/javascripts/app/controllers/widget/template.coffee index 224ad0f6c..82e42f6bb 100644 --- a/app/assets/javascripts/app/controllers/widget/template.coffee +++ b/app/assets/javascripts/app/controllers/widget/template.coffee @@ -83,11 +83,10 @@ class App.WidgetTemplate extends App.Controller e.preventDefault() # get params - form = @formParam($('.ticket-create')) + form = @formParam($(e.target).closest('.content').find('.ticket-create')) params = @formParam(e.target) name = params['template_name'] return if !name -# delete params['template_name'] template = App.Template.findByAttribute('name', name) if !template