[REF] web: move misplaced kanban quick create code

This commit is contained in:
qsm-odoo
2017-09-14 23:48:53 +02:00
parent 268b4a5a1d
commit 8496a31421
2 changed files with 12 additions and 7 deletions
@@ -144,16 +144,9 @@ var KanbanColumn = Widget.extend({
if (this.quickCreateWidget) {
return;
}
var self = this;
var width = this.records.length ? this.records[0].$el.innerWidth() : this.$el.width() - 8;
this.quickCreateWidget = new RecordQuickCreate(this, width);
this.quickCreateWidget.insertAfter(this.$header);
this.quickCreateWidget.$el.focusout(function () {
var taskName = self.quickCreateWidget.$('[type=text]')[0].value;
if (!taskName && self.quickCreateWidget) {
self._cancelQuickCreate();
}
});
},
/**
* Adds a record in the column.
@@ -16,6 +16,7 @@ var AbstractQuickCreate = Widget.extend({
'keypress input': '_onKeypress',
'mousedown .o_kanban_add': '_onMousedown',
'mousedown .o_kanban_cancel': '_onMousedown',
'focusout': '_onFocusOut',
},
//--------------------------------------------------------------------------
@@ -74,6 +75,17 @@ var AbstractQuickCreate = Widget.extend({
_onCancelClicked: function () {
this._cancel();
},
/**
* Cancels quick creation on focusout input event
*
* @private
* @param {KeyEvent} ev
*/
_onFocusOut: function (ev) {
if (!this.$input.val()) {
this._cancel();
}
},
/**
* Cancels quick creation on escape keydown event
*