diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-03-22 14:17:17 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 6bad524bb356654208a9bc9dada0de2cfc67b0af (patch) | |
| tree | f4c8821cffaf68166802376b054959d69b48200b /addons/web/static/src | |
| parent | b3015960c1e4dd282d948fb5f56490639d81c343 (diff) | |
[FIX] web: grouped Kanban: don't display nocontent helper
When the kanban is grouped and its groups contain no record, the
nocontent helper shouldn't be displayed. This wasn't the case
before this rev.
Diffstat (limited to 'addons/web/static/src')
3 files changed, 22 insertions, 6 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js index 2847003f5df..c21d7a43335 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -108,6 +108,17 @@ return AbstractController.extend(FieldManagerMixin, { } }, /** + * Used by list and kanban views to determine whether or not to display + * the no content helper (if there is no data in the state to display) + * + * @private + * @param {Object} state + * @returns {boolean} + */ + _hasContent: function (state) { + return state.count !== 0; + }, + /** * Hook method, called when record(s) has been deleted. * * @see _deleteRecord diff --git a/addons/web/static/src/js/views/kanban/kanban_controller.js b/addons/web/static/src/js/views/kanban/kanban_controller.js index c00cbc568d2..be288f1126d 100644 --- a/addons/web/static/src/js/views/kanban/kanban_controller.js +++ b/addons/web/static/src/js/views/kanban/kanban_controller.js @@ -104,12 +104,17 @@ var KanbanController = BasicController.extend({ this.renderer.updateRecord(this.model.get(id)); }, /** - * @todo this is dead code right now. resurrect this? + * The nocontent helper should be displayed in kanban: + * - ungrouped: if there is no records + * - grouped: if there is no groups and no column quick create * - * @returns {boolean} + * @override + * @private */ - _hasContent: function () { - return this._super.apply(this, arguments) || this.create_column_enabled; + _hasContent: function (state) { + return this._super.apply(this, arguments) || + this.create_column_enabled || + (state.groupedBy.length && state.data.length); }, /** * This method calls the server to ask for a resequence. Note that this @@ -144,7 +149,7 @@ var KanbanController = BasicController.extend({ * @returns {Deferred} */ _update: function (state) { - var hasNoContent = state.count === 0 && !this.create_column_enabled; + var hasNoContent = !this._hasContent(state); this.$el.toggleClass('o_kanban_nocontent', hasNoContent); this._toggleNoContentHelper(hasNoContent); return this._super.apply(this, arguments); diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index 2e764214459..b25b02b4513 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -200,7 +200,7 @@ var ListController = BasicController.extend({ * @returns {Deferred} */ _update: function (state) { - this._toggleNoContentHelper(state.count === 0); + this._toggleNoContentHelper(!this._hasContent(state)); this._toggleSidebar(); return this._super.apply(this, arguments); }, |
