Skip to content
Permalink
Browse files

Fixes #2881: Chat button is no longer optional in no jQuery version. …

…Thanks to @ma-jahn ❤️
  • Loading branch information
thorsteneckel committed Jan 13, 2020
1 parent 3bd3eeb commit 44806e79e54771aeecb86d37782fbe73ecb6b918
@@ -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)
@@ -1,7 +1,7 @@
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["agent"] = function (__obj) {
window.zammadChatTemplates["agent"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -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({
@@ -1953,7 +1961,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["chat"] = function (__obj) {
window.zammadChatTemplates["chat"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -2044,7 +2052,7 @@ window.zammadChatTemplates["chat"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["customer_timeout"] = function (__obj) {
window.zammadChatTemplates["customer_timeout"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -2117,7 +2125,7 @@ window.zammadChatTemplates["customer_timeout"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["loader"] = function (__obj) {
window.zammadChatTemplates["loader"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -2172,7 +2180,7 @@ window.zammadChatTemplates["loader"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["message"] = function (__obj) {
window.zammadChatTemplates["message"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -2239,7 +2247,7 @@ window.zammadChatTemplates["message"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["status"] = function (__obj) {
window.zammadChatTemplates["status"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -2294,7 +2302,7 @@ window.zammadChatTemplates["status"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["timestamp"] = function (__obj) {
window.zammadChatTemplates["timestamp"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -2353,7 +2361,7 @@ window.zammadChatTemplates["timestamp"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["typingIndicator"] = function (__obj) {
window.zammadChatTemplates["typingIndicator"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -2404,7 +2412,7 @@ window.zammadChatTemplates["typingIndicator"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["waiting"] = function (__obj) {
window.zammadChatTemplates["waiting"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@@ -2463,7 +2471,7 @@ window.zammadChatTemplates["waiting"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["waiting_list_timeout"] = function (__obj) {
window.zammadChatTemplates["waiting_list_timeout"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;

Large diffs are not rendered by default.

1 comment on commit 44806e7

@thorsteneckel

This comment has been minimized.

Copy link
Collaborator Author

thorsteneckel commented on 44806e7 Jan 13, 2020

Please sign in to comment.
You can’t perform that action at this time.