diff --git a/app/assets/javascripts/app/controllers/_application_controller/_base.coffee b/app/assets/javascripts/app/controllers/_application_controller/_base.coffee index ab2513699..5d55fbdc6 100644 --- a/app/assets/javascripts/app/controllers/_application_controller/_base.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller/_base.coffee @@ -82,9 +82,13 @@ class App.Controller extends Spine.Controller @el.empty() # release spine bindings (see release() of spine.coffee) + @off() @unbind() @stopListening() + release: -> + # nothing + abortAjaxCalls: => if !@ajaxCalls return @@ -96,11 +100,6 @@ class App.Controller extends Spine.Controller for callId in idsToCancel App.Ajax.abort(callId) - # release Spine's event handling - release: -> - @off() - @stopListening() - # add @title method to set title title: (name, translate = false) -> # $('html head title').html(@Config.get(product_name) + ' - ' + App.i18n.translateInline(name)) diff --git a/app/assets/javascripts/app/controllers/_application_controller/generic_index.coffee b/app/assets/javascripts/app/controllers/_application_controller/generic_index.coffee index 9daed4a70..9312b5eb3 100644 --- a/app/assets/javascripts/app/controllers/_application_controller/generic_index.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller/generic_index.coffee @@ -47,7 +47,7 @@ class App.ControllerGenericIndex extends App.Controller release: => if @subscribeId - App[ @genericObject ].unsubscribe(@subscribeId) + App[@genericObject].unsubscribe(@subscribeId) paginate: (page) => return if page is @pageData.pagerSelected diff --git a/app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee b/app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee index da290cb66..654bdca1a 100644 --- a/app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee +++ b/app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee @@ -50,7 +50,6 @@ class App.ManageKnowledgeBase extends App.ControllerTabs @fetchAndRender() release: -> - super @modal?.el.remove() processLoaded: -> diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create/sidebar.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create/sidebar.coffee index 550467ebe..24376011f 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create/sidebar.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create/sidebar.coffee @@ -1,6 +1,8 @@ -class App.TicketCreateSidebar extends App.Controller - constructor: -> - super +class App.TicketCreateSidebar + constructor: (options) -> + for key, value of options + @[key] = value + @render() reload: (args) => @@ -40,7 +42,10 @@ class App.TicketCreateSidebar extends App.Controller ) @sidebarItems.push @sidebarBackends[key] - new App.Sidebar( + if @sidebar + @sidebar.releaseController() + + @sidebar = new App.Sidebar( el: @el sidebarState: @sidebarState items: @sidebarItems diff --git a/app/assets/javascripts/app/controllers/api.coffee b/app/assets/javascripts/app/controllers/api.coffee index af23fa0c5..111e535fe 100644 --- a/app/assets/javascripts/app/controllers/api.coffee +++ b/app/assets/javascripts/app/controllers/api.coffee @@ -79,7 +79,6 @@ class Api extends App.ControllerSubContent release: => - super if @subscribeApplicationId App.Application.unsubscribe(@subscribeApplicationId) diff --git a/app/assets/javascripts/app/controllers/chat.coffee b/app/assets/javascripts/app/controllers/chat.coffee index da4a38a16..f8cb229bd 100644 --- a/app/assets/javascripts/app/controllers/chat.coffee +++ b/app/assets/javascripts/app/controllers/chat.coffee @@ -603,7 +603,6 @@ class ChatWindow extends App.Controller release: => @trigger('closed') @el.remove() - super clearUnread: => @$('.chat-message--new').removeClass('chat-message--new') diff --git a/app/assets/javascripts/app/controllers/dashboard.coffee b/app/assets/javascripts/app/controllers/dashboard.coffee index bc7ef4f14..06da5d2f0 100644 --- a/app/assets/javascripts/app/controllers/dashboard.coffee +++ b/app/assets/javascripts/app/controllers/dashboard.coffee @@ -89,9 +89,6 @@ class App.Dashboard extends App.Controller changed: -> false - release: -> - # no - toggle: (e) => @$('.tabs .tab').removeClass('active') $(e.target).addClass('active') diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.coffee index 20389ffc8..2a626f11f 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.coffee @@ -47,8 +47,11 @@ class App.TicketZoomSidebar extends App.ControllerObserver ) @sidebarItems.push @sidebarBackends[key] - new App.Sidebar( - el: @el.find('.tabsSidebar') + if @sidebar + @sidebar.releaseController() + + @sidebar = new App.Sidebar( + el: @$('.tabsSidebar') sidebarState: @sidebarState items: @sidebarItems ) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/taskbar_watcher.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/taskbar_watcher.coffee index f1b59e42b..927a6d7af 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/taskbar_watcher.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/taskbar_watcher.coffee @@ -5,8 +5,8 @@ class App.TaskbarWatcher extends App.Controller App.TaskManager.preferencesTrigger(@taskKey) release: => - return if !@subscribeId - App.TaskManager.preferencesUnsubscribe(@subscribeId) + if @subscribeId + App.TaskManager.preferencesUnsubscribe(@subscribeId) render: (preferences) => return if !preferences diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.coffee index 61b3460d9..154bf0e4c 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.coffee @@ -63,7 +63,6 @@ class App.OnlineNotificationWidget extends App.Controller release: -> $(window).off 'click.notifications' $(window).off 'keydown.notifications' - super access: -> return false if !@Session.get() diff --git a/app/assets/javascripts/app/controllers/widget/sidebar.coffee b/app/assets/javascripts/app/controllers/widget/sidebar.coffee index fe87e6ac9..b67ffc6e2 100644 --- a/app/assets/javascripts/app/controllers/widget/sidebar.coffee +++ b/app/assets/javascripts/app/controllers/widget/sidebar.coffee @@ -10,6 +10,7 @@ class App.Sidebar extends App.Controller constructor: -> super + @render() # get active tab by name @@ -61,7 +62,7 @@ class App.Sidebar extends App.Controller type: 'small' ) - @html localEl + @html(localEl) badgeRender: (el, item) => @badgeEl = el @@ -76,19 +77,18 @@ class App.Sidebar extends App.Controller toggleSidebar: => @el.parent().find('.tabsSidebar-sidebarSpacer').toggleClass('is-closed') - @el.parent().find('.tabsSidebar').toggleClass('is-closed') + @el.filter('.tabsSidebar').toggleClass('is-closed') #@el.parent().next('.attributeBar').toggleClass('is-closed') - showSidebar: -> + showSidebar: => @el.parent().find('.tabsSidebar-sidebarSpacer').removeClass('is-closed') - @el.parent().find('.tabsSidebar').removeClass('is-closed') + @el.filter('.tabsSidebar').removeClass('is-closed') #@el.parent().next('.attributeBar').addClass('is-closed') toggleTab: (e) => # get selected tab name = $(e.target).closest('.tabsSidebar-tab').data('tab') - if name # if current tab is selected again, toggle side bar @@ -99,7 +99,7 @@ class App.Sidebar extends App.Controller else @toggleTabAction(name) - toggleTabAction: (name) -> + toggleTabAction: (name) => return if !name # remember sidebarState for outsite diff --git a/app/assets/javascripts/app/controllers/widget/update_taskbar.coffee b/app/assets/javascripts/app/controllers/widget/update_taskbar.coffee index 3f419eb57..b755b181f 100644 --- a/app/assets/javascripts/app/controllers/widget/update_taskbar.coffee +++ b/app/assets/javascripts/app/controllers/widget/update_taskbar.coffee @@ -6,7 +6,7 @@ class App.UpdateTastbar extends App.Controller @subscribeId = @genericObject.subscribe(@update) release: => - App[ @genericObject.constructor.className ].unsubscribe(@subscribeId) + App[@genericObject.constructor.className].unsubscribe(@subscribeId) update: (genericObject) =>