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

View file

@ -47,5 +47,5 @@ class App.KnowledgeBasePublicMenuManager extends App.Controller
new App.KnowledgeBasePublicMenuForm( new App.KnowledgeBasePublicMenuForm(
location: location, location: location,
knowledge_base_id: @knowledge_base_id 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 button.disabled = false
new App.KnowledgeBaseServerSnippet( new App.KnowledgeBaseServerSnippet(
container: @el.closest('.main') container: @el.closest('.content')
snippets: data.snippets snippets: data.snippets
address: data.address address: data.address
address_type: data.address_type address_type: data.address_type
@ -140,6 +140,6 @@ class App.KnowledgeBaseCustomAddressForm extends App.KnowledgeBaseForm
new App.ControllerErrorModal( new App.ControllerErrorModal(
message: xhr.responseJSON.error 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() formController.hideAlert()
loader = new App.ControllerModalLoading( loader = new App.ControllerModalLoading(
container: @parentVC.el container: @parentVC.el.closest('.content')
) )
@ajax( @ajax(

View file

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

View file

@ -2096,7 +2096,7 @@ msgstr ""
msgid "Could not read raw logo!" msgid "Could not read raw logo!"
msgstr "" 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" msgid "Couldn't create Knowledge Base"
msgstr "" msgstr ""
@ -2145,7 +2145,7 @@ msgstr ""
msgid "Create Channels" msgid "Create Channels"
msgstr "" 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" msgid "Create Knowledge Base"
msgstr "" msgstr ""
@ -9072,10 +9072,6 @@ msgstr ""
msgid "There is existing content. Do you want to overwrite it?" msgid "There is existing content. Do you want to overwrite it?"
msgstr "" 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 #: app/assets/javascripts/app/views/channel/chat.jst.eco
msgid "There is no agent online." msgid "There is no agent online."
msgstr "" msgstr ""