From 6d684c74cf3200cf11d621896493c0b7f0a1dfcb Mon Sep 17 00:00:00 2001 From: Mantas Masalskis Date: Wed, 13 Nov 2019 11:30:16 +0100 Subject: [PATCH] Fixes #2784 - new Knowledge Base modal in settings is removed properly when moving to another setting tab --- .../app/controllers/_manage/knowledge_base.coffee | 6 +++++- .../javascripts/app/views/knowledge_base/new_modal.coffee | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee b/app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee index 632ddfc33..337cc40f4 100644 --- a/app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee +++ b/app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee @@ -49,6 +49,10 @@ class App.ManageKnowledgeBase extends App.ControllerTabs App.KnowledgeBase.find(@knowledge_base_id).remove(clear: true) @fetchAndRender() + release: -> + super + @modal.el.remove() + processLoaded: -> if @knowledge_base_id @renderLoaded() @@ -59,7 +63,7 @@ class App.ManageKnowledgeBase extends App.ControllerTabs @renderScreenError(detail: 'No Knowledge Base. Please create first Knowledge Base', el: @$('.page-content')) @headerSwitchInput.prop('checked', false) - new App.KnowledgeBaseNewModal( + @modal = new App.KnowledgeBaseNewModal( parentVC: @ container: @el.closest('.main') ) diff --git a/app/assets/javascripts/app/views/knowledge_base/new_modal.coffee b/app/assets/javascripts/app/views/knowledge_base/new_modal.coffee index 830f3b27b..3dbb91fd8 100644 --- a/app/assets/javascripts/app/views/knowledge_base/new_modal.coffee +++ b/app/assets/javascripts/app/views/knowledge_base/new_modal.coffee @@ -46,6 +46,7 @@ class App.KnowledgeBaseNewModal extends App.ControllerModal success: (data) => @parentVC.fetchAndRender() + @parentVC.modal = undefined @close() error: (xhr) =>