Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Martin Edenhofer 2015-11-11 11:25:12 +01:00
commit 600649d51a
10 changed files with 119 additions and 95 deletions

View file

@ -1892,24 +1892,24 @@ class App.CustomerChatRef extends App.Controller
else else
@nextQuestion() @nextQuestion()
class CustomerChatRouter extends App.ControllerPermanent # class CustomerChatRouter extends App.ControllerPermanent
constructor: (params) -> # constructor: (params) ->
super # super
# check authentication # # check authentication
return if !@authenticate() # return if !@authenticate()
App.TaskManager.execute( # App.TaskManager.execute(
key: 'CustomerChatRef' # key: 'CustomerChatRef'
controller: 'CustomerChatRef' # controller: 'CustomerChatRef'
params: {} # params: {}
show: true # show: true
persistent: true # persistent: true
) # )
App.Config.set( 'layout_ref/customer_chat', CustomerChatRouter, 'Routes' ) # App.Config.set( 'layout_ref/customer_chat', CustomerChatRouter, 'Routes' )
App.Config.set( 'CustomerChatRef', { controller: 'CustomerChatRef', authentication: true }, 'permanentTask' ) # App.Config.set( 'CustomerChatRef', { controller: 'CustomerChatRef', authentication: true }, 'permanentTask' )
App.Config.set( 'CustomerChatRef', { prio: 1200, parent: '', name: 'Customer Chat', target: '#layout_ref/customer_chat', key: 'CustomerChatRef', role: ['Agent'], class: 'chat' }, 'NavBar' ) # App.Config.set( 'CustomerChatRef', { prio: 1200, parent: '', name: 'Customer Chat', target: '#layout_ref/customer_chat', key: 'CustomerChatRef', role: ['Agent'], class: 'chat' }, 'NavBar' )
class chatWindowRef extends Spine.Controller class chatWindowRef extends Spine.Controller

View file

@ -6890,6 +6890,11 @@ output {
} }
} }
/*
datepicker resets some css it potentially inherits when its rendered inside a table
*/
.datepicker { .datepicker {
background: hsl(234,10%,19%); background: hsl(234,10%,19%);
color: white; color: white;
@ -6909,6 +6914,14 @@ output {
} }
} }
th {
background: none;
}
th, td {
border: none;
}
.next, .next,
.prev { .prev {
cursor: pointer; cursor: pointer;
@ -6938,7 +6951,7 @@ output {
width: 27px; width: 27px;
height: 26px; height: 26px;
border-radius: 100%; border-radius: 100%;
padding: 1px 0 0; padding: 1px 0 0 !important;
} }
.month, .month,

View file

@ -46,10 +46,9 @@ do($ = window.jQuery, window) ->
@el.find('.zammad-chat-header').click @toggle @el.find('.zammad-chat-header').click @toggle
@el.find('.zammad-chat-controls').on 'submit', @onSubmit @el.find('.zammad-chat-controls').on 'submit', @onSubmit
@el.find('.zammad-chat-input').on( @el.find('.zammad-chat-input').on
keydown: @checkForEnter keydown: @checkForEnter
input: @onInput input: @onInput
).autoGrow { extraLine: false }
@session_id = undefined @session_id = undefined
@ -122,7 +121,10 @@ do($ = window.jQuery, window) ->
console.log 'Zammad Chat: Too many clients in queue. Clients in queue: ', pipe.data.queue console.log 'Zammad Chat: Too many clients in queue. Clients in queue: ', pipe.data.queue
onReady: => onReady: =>
@show() if @options.show if @options.show
@show()
@el.find('.zammad-chat-input').autoGrow
extraLine: false
onInput: => onInput: =>
# remove unread-state from messages # remove unread-state from messages

View file

@ -170,12 +170,14 @@
margin: 0.5em 0; } margin: 0.5em 0; }
.zammad-chat-message-body { .zammad-chat-message-body {
padding: 0.6em 1em; padding: 0.5em 1em;
line-height: 1.4;
border-radius: 1em; border-radius: 1em;
background: #f6f8f9; background: #f6f8f9;
display: inline-block; display: inline-block;
max-width: 70%; max-width: 70%;
white-space: pre; white-space: pre-line;
word-wrap: break-word;
box-shadow: 0 2px rgba(255, 255, 255, 0.15) inset, 0 0 0 1px rgba(0, 0, 0, 0.08) inset, 0 1px rgba(0, 0, 0, 0.02); } box-shadow: 0 2px rgba(255, 255, 255, 0.15) inset, 0 0 0 1px rgba(0, 0, 0, 0.08) inset, 0 1px rgba(0, 0, 0, 0.02); }
.zammad-chat-message--customer { .zammad-chat-message--customer {

View file

@ -1,3 +1,68 @@
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> ');
__out.push(this.agentPhrase);
__out.push('\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); }; };
(function($, window) { (function($, window) {
@ -85,8 +150,6 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
this.el.find('.zammad-chat-input').on({ this.el.find('.zammad-chat-input').on({
keydown: this.checkForEnter, keydown: this.checkForEnter,
input: this.onInput input: this.onInput
}).autoGrow({
extraLine: false
}); });
this.session_id = void 0; this.session_id = void 0;
if (!window.WebSocket) { if (!window.WebSocket) {
@ -197,7 +260,10 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
ZammadChat.prototype.onReady = function() { ZammadChat.prototype.onReady = function() {
if (this.options.show) { if (this.options.show) {
return this.show(); this.show();
return this.el.find('.zammad-chat-input').autoGrow({
extraLine: false
});
} }
}; };
@ -427,69 +493,6 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
}); });
})(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() {
__out.push('<img class="zammad-chat-agent-avatar" src="');
__out.push(__sanitize(this.agent.avatar));
__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> ');
__out.push(this.agentPhrase);
__out.push('\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):
@ -782,7 +785,7 @@ window.zammadChatTemplates["status"] = function (__obj) {
__out.push(__sanitize(this.label)); __out.push(__sanitize(this.label));
__out.push('</strong>'); __out.push('</strong> ');
__out.push(__sanitize(this.time)); __out.push(__sanitize(this.time));

File diff suppressed because one or more lines are too long

View file

@ -203,12 +203,14 @@ $baseTextColor: if($luminance < 0.2, white, black);
} }
.zammad-chat-message-body { .zammad-chat-message-body {
padding: 0.6em 1em; padding: 0.5em 1em;
line-height: 1.4;
border-radius: 1em; border-radius: 1em;
background: desaturate(lightenMax($themeColor, 50%, 97%), 50%); background: desaturate(lightenMax($themeColor, 50%, 97%), 50%);
display: inline-block; display: inline-block;
max-width: 70%; max-width: 70%;
white-space: pre; white-space: pre-line;
word-wrap: break-word;
box-shadow: box-shadow:
0 2px rgba(255,255,255,.15) inset, 0 2px rgba(255,255,255,.15) inset,
0 0 0 1px rgba(0,0,0,.08) inset, 0 0 0 1px rgba(0,0,0,.08) inset,

View file

@ -11,7 +11,7 @@ var merge = require('merge-stream');
var plumber = require('gulp-plumber'); var plumber = require('gulp-plumber');
gulp.task('css', function(){ gulp.task('css', function(){
return gulp.src('style.scss') return gulp.src('chat.scss')
.pipe(sass.sync().on('error', gutil.log)) .pipe(sass.sync().on('error', gutil.log))
.pipe(autoprefixer({ .pipe(autoprefixer({
browsers: ['last 4 versions'], browsers: ['last 4 versions'],
@ -40,7 +40,7 @@ gulp.task('js', function(){
}); });
gulp.task('default', function(){ gulp.task('default', function(){
var cssWatcher = gulp.watch('style.scss', ['css']); var cssWatcher = gulp.watch('chat.scss', ['css']);
cssWatcher.on('change', function(event) { cssWatcher.on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...'); console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
}); });

View file

@ -1,9 +1,9 @@
<!doctype html> <!doctype html>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Zammad Chat</title> <title>Zammad Chat</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="chat.css">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script> <script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35738/livereload.js?snipver=1"></' + 'script>')</script>
<style> <style>
body { body {
margin: 0; margin: 0;

View file

@ -1,4 +1,6 @@
<% if @agent.avatar: %>
<img class="zammad-chat-agent-avatar" src="<%= @agent.avatar %>"> <img class="zammad-chat-agent-avatar" src="<%= @agent.avatar %>">
<% end %>
<span class="zammad-chat-agent-sentence"> <span class="zammad-chat-agent-sentence">
<span class="zammad-chat-agent-name"><%= @agent.name %></span> <%- @agentPhrase %> <span class="zammad-chat-agent-name"><%= @agent.name %></span> <%- @agentPhrase %>
</span> </span>