Fixes #2881: Chat button is no longer optional in no jQuery version. Thanks to @ma-jahn ❤️

This commit is contained in:
Thorsten Eckel 2020-01-13 10:58:16 +01:00
parent 3bd3eeb163
commit 44806e79e5
3 changed files with 28 additions and 15 deletions

View file

@ -467,7 +467,9 @@ do(window) ->
@renderBase()
# disable open button
document.querySelector(".#{ @options.buttonClass }").classList.add @inactiveClass
btn = document.querySelector(".#{ @options.buttonClass }")
if btn
btn.classList.add @inactiveClass
@setAgentOnlineState 'online'
@ -770,7 +772,10 @@ do(window) ->
onError: (message) =>
@log.debug message
@addStatus(message)
document.querySelector(".#{ @options.buttonClass }").classList.add('zammad-chat-is-hidden')
btn = document.querySelector(".#{ @options.buttonClass }")
if btn
btn.classList.add('zammad-chat-is-hidden')
if @isOpen
@disableInput()
@destroy(remove: false)

View file

@ -739,10 +739,14 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
};
ZammadChat.prototype.render = function() {
var btn;
if (!this.el || !document.querySelector('.zammad-chat')) {
this.renderBase();
}
document.querySelector("." + this.options.buttonClass).classList.add(this.inactiveClass);
btn = document.querySelector("." + this.options.buttonClass);
if (btn) {
btn.classList.add(this.inactiveClass);
}
this.setAgentOnlineState('online');
this.log.debug('widget rendered');
this.startTimeoutObservers();
@ -1088,9 +1092,13 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
};
ZammadChat.prototype.onError = function(message) {
var btn;
this.log.debug(message);
this.addStatus(message);
document.querySelector("." + this.options.buttonClass).classList.add('zammad-chat-is-hidden');
btn = document.querySelector("." + this.options.buttonClass);
if (btn) {
btn.classList.add('zammad-chat-is-hidden');
}
if (this.isOpen) {
this.disableInput();
return this.destroy({

File diff suppressed because one or more lines are too long