diff options
| author | Géry Debongnie <ged@odoo.com> | 2018-01-29 16:01:21 +0100 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2018-01-31 16:46:56 +0100 |
| commit | 31a99ed5b79ba1bfa1fe7e35bcfc7a573912e19b (patch) | |
| tree | 3f6aef4af6609186b701b049c2c07d15f721b59f /addons/web/static/src/js | |
| parent | 079a13a349c942ab69ca704263bc5cb52c391d92 (diff) | |
[IMP] web: add better message in column quick create
This commit add a help message in the column to indicate that pressing
escape will discard the current column creation. Note that some JS had
to be added to make the message disappear when the input is no longer
focused. The reason is that the create column widget may still be visible when
the input is no longer focused (for example, because the user clicked on
the fake records, or clicked on the example link)
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/views/kanban/kanban_column_quick_create.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js index 78191d3ab75..afeeb4203ad 100644 --- a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js +++ b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js @@ -21,6 +21,8 @@ var ColumnQuickCreate = Widget.extend({ 'click .o_kanban_examples': '_onShowExamples', 'keydown': '_onKeydown', 'keypress input': '_onKeypress', + 'blur input': '_onInputBlur', + 'focus input': '_onInputFocus', }, /** @@ -125,6 +127,27 @@ var ColumnQuickCreate = Widget.extend({ this._add(); }, /** + * When the input is not focused, no key event may occur in the column, so + * the discard feature will not work by pressing ESC. We simply hide the + * help message in that case, so we do not mislead our users. + * + * @private + * @param {KeyboardEvent} event + */ + _onInputBlur: function () { + this.$('.o_discard_msg').hide(); + }, + /** + * When the input is focused, we need to show the discard help message (it + * might have been hidden, @see _onInputBlur) + * + * @private + * @param {KeyboardEvent} event + */ + _onInputFocus: function () { + this.$('.o_discard_msg').show(); + }, + /** * Cancels quick creation on escape keydown event * * @private |
