Fixes #4008 - KB Public menus scroll bar positioning incorrect

This commit is contained in:
Mantas Masalskis 2022-03-27 06:58:10 +02:00 committed by Mantas
parent 94a467a2a3
commit 68d7592610
6 changed files with 42 additions and 41 deletions

View file

@ -49,9 +49,6 @@ class App.ManageKnowledgeBase extends App.ControllerTabs
App.KnowledgeBase.find(@knowledge_base_id).remove(clear: true)
@fetchAndRender()
release: ->
@modal?.el.remove()
processLoaded: ->
if @knowledge_base_id
@renderLoaded()
@ -59,13 +56,18 @@ class App.ManageKnowledgeBase extends App.ControllerTabs
@renderNonExistant()
renderNonExistant: ->
@renderScreenError(detail: __('There is no Knowledge Base yet. Please create one.'), el: @$('.page-content'))
@headerSwitchInput.prop('checked', false)
@headerSwitchInput.attr('disabled', true)
@modal = new App.KnowledgeBaseNewModal(
parentVC: @
container: @el.closest('.main')
)
@tabs =[
{
name: __('Theme')
target: 'style'
controller: App.KnowledgeBaseNewController
params: { parentVC: @ }
}
]
@render()
didChangeHeaderSwitch: ->
@headerSwitchInput.prop('disabled', true)
@ -89,6 +91,8 @@ class App.ManageKnowledgeBase extends App.ControllerTabs
)
renderLoaded: ->
@headerSwitchInput.attr('disabled', false)
params = {
knowledge_base_id: @knowledge_base_id
parentVC: @

View file

@ -47,5 +47,5 @@ class App.KnowledgeBasePublicMenuManager extends App.Controller
new App.KnowledgeBasePublicMenuForm(
location: location,
knowledge_base_id: @knowledge_base_id
container: @el.closest('.main')
container: @el.closest('.content')
)

View file

@ -127,7 +127,7 @@ class App.KnowledgeBaseCustomAddressForm extends App.KnowledgeBaseForm
button.disabled = false
new App.KnowledgeBaseServerSnippet(
container: @el.closest('.main')
container: @el.closest('.content')
snippets: data.snippets
address: data.address
address_type: data.address_type
@ -140,6 +140,6 @@ class App.KnowledgeBaseCustomAddressForm extends App.KnowledgeBaseForm
new App.ControllerErrorModal(
message: xhr.responseJSON.error
container: @el.closest('.main')
container: @el.closest('.content')
)
)

View file

@ -16,7 +16,7 @@ class App.KnowledgeBaseDelete extends App.KnowledgeBaseForm
formController.hideAlert()
loader = new App.ControllerModalLoading(
container: @parentVC.el
container: @parentVC.el.closest('.content')
)
@ajax(

View file

@ -1,27 +1,28 @@
class App.KnowledgeBaseNewModal extends App.ControllerModal
head: __('Create Knowledge Base')
screen: 'admin_create'
buttonClose: false
buttonCancel: false
backdrop: 'static'
keyboard: false
class App.KnowledgeBaseNewController extends App.Controller
events:
'submit form': 'submit'
constructor: ->
@formController = new App.ControllerForm(
model: App.KnowledgeBase
params: @item
screen: @screen
autofocus: false
)
super
content: ->
@formController.form
@render()
render: ->
@formController = new App.ControllerForm(
model: App.KnowledgeBase
screen: 'admin_create'
autofocus: false
formClass: 'settings-entry'
fullForm: true
fullFormSubmitLabel: __('Create Knowledge Base')
fullFormButtonsContainerClass: 'justify-end'
fullFormSubmitAdditionalClasses: 'btn--success'
)
@el.html @formController.form
prepareParams: (params) ->
for key, attribute of App.KnowledgeBase.attributesGet(@screen)
for key, attribute of App.KnowledgeBase.attributesGet(@formController.screen)
dom = @$(".#{attribute.tag}[data-attribute-name=#{attribute.name}]")
App.UiElement[attribute.tag].prepareParams?(attribute, dom, params)
@ -33,8 +34,10 @@ class App.KnowledgeBaseNewModal extends App.ControllerModal
params['homepage_layout'] = 'grid'
params['category_layout'] = 'grid'
onSubmit: (e) ->
params = @formParams(@el)
submit: (e) ->
@preventDefaultAndStopPropagation(e)
params = @formParam(@el)
@prepareParams(params)
@applyDefaults(params)
@ -47,8 +50,6 @@ class App.KnowledgeBaseNewModal extends App.ControllerModal
success: (data) =>
@parentVC.fetchAndRender()
@parentVC.modal = undefined
@close()
error: (xhr) =>
@formEnable(@el)

View file

@ -2096,7 +2096,7 @@ msgstr ""
msgid "Could not read raw logo!"
msgstr ""
#: app/assets/javascripts/app/views/knowledge_base/new_modal.coffee
#: app/assets/javascripts/app/views/knowledge_base/new_controller.coffee
msgid "Couldn't create Knowledge Base"
msgstr ""
@ -2145,7 +2145,7 @@ msgstr ""
msgid "Create Channels"
msgstr ""
#: app/assets/javascripts/app/views/knowledge_base/new_modal.coffee
#: app/assets/javascripts/app/views/knowledge_base/new_controller.coffee
msgid "Create Knowledge Base"
msgstr ""
@ -9072,10 +9072,6 @@ msgstr ""
msgid "There is existing content. Do you want to overwrite it?"
msgstr ""
#: app/assets/javascripts/app/controllers/_manage/knowledge_base.coffee
msgid "There is no Knowledge Base yet. Please create one."
msgstr ""
#: app/assets/javascripts/app/views/channel/chat.jst.eco
msgid "There is no agent online."
msgstr ""