chat client: fix open/close icon

This commit is contained in:
Felix Niklas 2015-11-25 14:47:02 +01:00
parent 50cf1fa018
commit a2f9861fca
5 changed files with 79 additions and 78 deletions

View file

@ -288,8 +288,7 @@ do($ = window.jQuery, window) ->
if !@sessionId if !@sessionId
@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
@ -319,6 +318,7 @@ do($ = window.jQuery, window) ->
@closeWindow() @closeWindow()
closeWindow: => closeWindow: =>
@el.removeClass('zammad-chat-is-open')
remainerHeight = @el.height() - @el.find('.zammad-chat-header').outerHeight() remainerHeight = @el.height() - @el.find('.zammad-chat-header').outerHeight()
@el.animate { bottom: -remainerHeight }, 500, @onCloseAnimationEnd @el.animate { bottom: -remainerHeight }, 500, @onCloseAnimationEnd
@ -337,12 +337,12 @@ do($ = window.jQuery, window) ->
@onWebSocketOpen() @onWebSocketOpen()
hide: -> hide: ->
@el.removeClass('zammad-chat-is-visible') @el.removeClass('zammad-chat-is-shown')
show: -> show: ->
return @state if @state is 'off' or @state is 'unsupported' return @state if @state is 'off' or @state is 'unsupported'
@el.addClass('zammad-chat-is-visible') @el.addClass('zammad-chat-is-shown')
if !@inputInitialized if !@inputInitialized
@inputInitialized = true @inputInitialized = true

View file

@ -25,7 +25,7 @@
height: 100vh; height: 100vh;
border-radius: 0 !important; } } border-radius: 0 !important; } }
.zammad-chat.zammad-chat-is-visible { .zammad-chat.zammad-chat-is-shown {
display: -webkit-flex; display: -webkit-flex;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; } display: flex; }
@ -54,7 +54,7 @@
.zammad-chat.is-fullscreen .zammad-chat-header { .zammad-chat.is-fullscreen .zammad-chat-header {
border-radius: 0 !important; } border-radius: 0 !important; }
.zammad-chat.zammad-chat-is-visible .zammad-chat-header { .zammad-chat.zammad-chat-is-open .zammad-chat-header {
cursor: default; } cursor: default; }
.zammad-chat-welcome-text { .zammad-chat-welcome-text {
@ -80,10 +80,10 @@
width: 1.3em; } width: 1.3em; }
.zammad-chat-header-icon-close, .zammad-chat-header-icon-close,
.zammad-chat.zammad-chat-is-visible .zammad-chat-header-icon-open { .zammad-chat.zammad-chat-is-open .zammad-chat-header-icon-open {
display: none; } display: none; }
.zammad-chat.zammad-chat-is-visible .zammad-chat-header-icon-close { .zammad-chat.zammad-chat-is-open .zammad-chat-header-icon-close {
display: inline; } display: inline; }
.zammad-chat-agent { .zammad-chat-agent {
@ -105,7 +105,7 @@
margin: 0 1em; margin: 0 1em;
display: inline-block; display: inline-block;
line-height: 2em; line-height: 2em;
padding: 0 .7em; padding: 0 0.7em;
border-radius: 1em; border-radius: 1em;
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04) inset; } box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04) inset; }

View file

@ -375,7 +375,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-visible'); this.el.addClass('zammad-chat-is-open');
if (!this.sessionId) { if (!this.sessionId) {
this.el.animate({ this.el.animate({
bottom: 0 bottom: 0
@ -410,6 +410,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
ZammadChat.prototype.closeWindow = function() { ZammadChat.prototype.closeWindow = function() {
var remainerHeight; var remainerHeight;
this.el.removeClass('zammad-chat-is-open');
remainerHeight = this.el.height() - this.el.find('.zammad-chat-header').outerHeight(); remainerHeight = this.el.height() - this.el.find('.zammad-chat-header').outerHeight();
return this.el.animate({ return this.el.animate({
bottom: -remainerHeight bottom: -remainerHeight
@ -429,7 +430,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
}; };
ZammadChat.prototype.hide = function() { ZammadChat.prototype.hide = function() {
return this.el.removeClass('zammad-chat-is-visible'); return this.el.removeClass('zammad-chat-is-shown');
}; };
ZammadChat.prototype.show = function() { ZammadChat.prototype.show = function() {
@ -437,7 +438,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
if (this.state === 'off' || this.state === 'unsupported') { if (this.state === 'off' || this.state === 'unsupported') {
return this.state; return this.state;
} }
this.el.addClass('zammad-chat-is-visible'); this.el.addClass('zammad-chat-is-shown');
if (!this.inputInitialized) { if (!this.inputInitialized) {
this.inputInitialized = true; this.inputInitialized = true;
this.input.autoGrow({ this.input.autoGrow({
@ -683,6 +684,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, '&')
.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):
@ -760,67 +822,6 @@ jQuery.fn.autoGrow = function(options) {
}); });
}; };
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('');
};
if (!window.zammadChatTemplates) { if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {}; window.zammadChatTemplates = {};
} }

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-visible { .zammad-chat.zammad-chat-is-shown {
display: flex; display: flex;
} }
@ -62,7 +62,7 @@
border-radius: 0 !important; border-radius: 0 !important;
} }
.zammad-chat.zammad-chat-is-visible .zammad-chat-header { .zammad-chat.zammad-chat-is-open .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-visible .zammad-chat-header-icon-open { .zammad-chat.zammad-chat-is-open .zammad-chat-header-icon-open {
display: none; display: none;
} }
.zammad-chat.zammad-chat-is-visible .zammad-chat-header-icon-close { .zammad-chat.zammad-chat-is-open .zammad-chat-header-icon-close {
display: inline; display: inline;
} }