[IMP] web: make kanban create button jump

This commit makes the create button of a kanban view
jumping when the user click on some zone on the kanban
background.
The purpose here is to educate the user, so he can learn
how to create its first kanban card.

Task-1893021
This commit is contained in:
jem-odoo
2019-01-16 08:28:09 +00:00
parent 1bb6d73949
commit e7268c201e
@@ -33,6 +33,9 @@ var KanbanController = BasicController.extend({
column_toggle_fold: '_onToggleColumn',
kanban_column_records_toggle_active: '_onToggleActiveRecords',
}),
events: _.extend({}, BasicController.prototype.events, {
click: '_onClick',
}),
/**
* @override
* @param {Object} params
@@ -302,6 +305,23 @@ var KanbanController = BasicController.extend({
this.$('.o_kanban_record:first').focus();
}
},
/**
* Bounce the 'Create' button.
*
* @private
* @param {MouseEvent} ev
**/
_onClick: function (ev) {
var state = this.model.get(this.handle, {raw: true});
if (!state.count && this.buttons) {
var classesList = ['o_kanban_view', 'o_kanban_group', 'o_column_quick_create', 'o_view_nocontent_smiling_face'];
var $target = $(ev.target);
var hasClassList = _.map(classesList, function(klass){ return $target.hasClass(klass) });
if (_.some(hasClassList)) {
this.$buttons.find('.o-kanban-button-new').odooBounce();
}
}
},
/**
* @private
* @param {OdooEvent} ev