chat client: rename is-open to is-visible

This commit is contained in:
Felix Niklas 2015-11-24 15:20:38 +01:00
parent 48f9d4fc10
commit 1bbf80c80a
4 changed files with 78 additions and 76 deletions

View file

@ -281,7 +281,7 @@ do($ = window.jQuery, window) ->
@showLoader() @showLoader()
@el @el
.addClass('zammad-chat-is-open') .addClass('zammad-chat-is-visible')
if !@sessionId if !@sessionId
@el.animate { bottom: 0 }, 500, @onOpenAnimationEnd @el.animate { bottom: 0 }, 500, @onOpenAnimationEnd
@ -315,7 +315,7 @@ do($ = window.jQuery, window) ->
@el.animate { bottom: -remainerHeight }, 500, @onCloseAnimationEnd @el.animate { bottom: -remainerHeight }, 500, @onCloseAnimationEnd
onCloseAnimationEnd: => onCloseAnimationEnd: =>
@el.removeClass('zammad-chat-is-open') @el.removeClass('zammad-chat-is-visible')
@disconnect() @disconnect()
@isOpen = false @isOpen = false

View file

@ -1,64 +1,3 @@
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["agent"] = function (__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
}
(function() {
(function() {
if (this.agent.avatar) {
__out.push('\n<img class="zammad-chat-agent-avatar" src="');
__out.push(__sanitize(this.agent.avatar));
__out.push('">\n');
}
__out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
__out.push(__sanitize(this.agent.name));
__out.push('</span>\n</span>');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
};
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
slice = [].slice; slice = [].slice;
@ -74,9 +13,10 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
host: '', host: '',
port: 6042, port: 6042,
debug: false, debug: false,
flat: false,
fontSize: void 0, fontSize: void 0,
buttonSelector: '.open-zammad-chat', buttonClass: 'open-zammad-chat',
hiddenButtonClass: 'is-inactive', inactiveClass: 'is-inactive',
title: '<strong>Chat</strong> with us!' title: '<strong>Chat</strong> with us!'
}; };
@ -206,6 +146,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
})); }));
this.options.target.append(this.el); this.options.target.append(this.el);
this.input = this.el.find('.zammad-chat-input'); this.input = this.el.find('.zammad-chat-input');
$("." + this.options.buttonClass).addClass(this.inactiveClass);
this.el.find('.js-chat-open').click(this.open); this.el.find('.js-chat-open').click(this.open);
this.el.find('.js-chat-close').click(this.close); this.el.find('.js-chat-close').click(this.close);
this.el.find('.zammad-chat-controls').on('submit', this.onSubmit); this.el.find('.zammad-chat-controls').on('submit', this.onSubmit);
@ -298,7 +239,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
}; };
ZammadChat.prototype.onReady = function() { ZammadChat.prototype.onReady = function() {
$(this.options.buttonSelector).click(this.open).removeClass(this.hiddenButtonClass); $("." + this.options.buttonClass).click(this.open).removeClass(this.inactiveClass);
if (this.options.show) { if (this.options.show) {
return this.show(); return this.show();
} }
@ -306,7 +247,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
ZammadChat.prototype.onError = function(message) { ZammadChat.prototype.onError = function(message) {
this.log('debug', message); this.log('debug', message);
return $(this.options.buttonSelector).hide(); return $("." + this.options.buttonClass).hide();
}; };
ZammadChat.prototype.reopenSession = function(data) { ZammadChat.prototype.reopenSession = function(data) {
@ -423,7 +364,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
if (!this.sessionId) { if (!this.sessionId) {
this.showLoader(); this.showLoader();
} }
this.el.addClass('zammad-chat-is-open'); this.el.addClass('zammad-chat-is-visible');
if (!this.sessionId) { if (!this.sessionId) {
this.el.animate({ this.el.animate({
bottom: 0 bottom: 0
@ -465,7 +406,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
}; };
ZammadChat.prototype.onCloseAnimationEnd = function() { ZammadChat.prototype.onCloseAnimationEnd = function() {
this.el.removeClass('zammad-chat-is-open'); this.el.removeClass('zammad-chat-is-visible');
this.disconnect(); this.disconnect();
this.isOpen = false; this.isOpen = false;
this.send('chat_session_close', { this.send('chat_session_close', {
@ -724,6 +665,67 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
return window.ZammadChat = ZammadChat; return window.ZammadChat = ZammadChat;
})(window.jQuery, window); })(window.jQuery, window);
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["agent"] = function (__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
}
(function() {
(function() {
if (this.agent.avatar) {
__out.push('\n<img class="zammad-chat-agent-avatar" src="');
__out.push(__sanitize(this.agent.avatar));
__out.push('">\n');
}
__out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
__out.push(__sanitize(this.agent.name));
__out.push('</span>\n</span>');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
};
/*! /*!
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42): * "THE BEER-WARE LICENSE" (Revision 42):
@ -932,7 +934,7 @@ window.zammadChatTemplates["loader"] = function (__obj) {
(function() { (function() {
__out.push('<div class="zammad-chat-modal">\n <span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n </span>\n <span class="zammad-chat-modal-text">'); __out.push('<div class="zammad-chat-modal">\n <span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n </span>\n <span class="zammad-chat-modal-text">');
__out.push(__sanitize(this.T('Connecting'))); __out.push(this.T('Connecting'));
__out.push('</span>\n</div>'); __out.push('</span>\n</div>');
@ -1117,7 +1119,7 @@ window.zammadChatTemplates["timeout"] = function (__obj) {
__out.push('>'); __out.push('>');
__out.push(__sanitize(this.T('Start new conversation'))); __out.push(this.T('Start new conversation'));
__out.push('</div>\n </div>\n</div>'); __out.push('</div>\n </div>\n</div>');

File diff suppressed because one or more lines are too long

View file

@ -26,7 +26,7 @@
border-radius: 0 !important; border-radius: 0 !important;
} }
} }
.zammad-chat.zammad-chat-is-open { .zammad-chat.zammad-chat-is-visible {
display: flex; display: flex;
} }
@ -62,7 +62,7 @@
border-radius: 0 !important; border-radius: 0 !important;
} }
.zammad-chat.zammad-chat-is-open .zammad-chat-header { .zammad-chat.zammad-chat-is-visible .zammad-chat-header {
cursor: default; cursor: default;
} }
@ -93,11 +93,11 @@
} }
.zammad-chat-header-icon-close, .zammad-chat-header-icon-close,
.zammad-chat.zammad-chat-is-open .zammad-chat-header-icon-open { .zammad-chat.zammad-chat-is-visible .zammad-chat-header-icon-open {
display: none; display: none;
} }
.zammad-chat.zammad-chat-is-open .zammad-chat-header-icon-close { .zammad-chat.zammad-chat-is-visible .zammad-chat-header-icon-close {
display: inline; display: inline;
} }