[IMP] web: support action helper on gantt view
Currently, only List and Kanban view supports the action helper and display the folder icon with the helper text. With this commit we have also provided the action helper support for other views. The logic for no content helper has been moved in abstract_renderer.js so that it can be accessed by all views. This was done mainly to give the action helper to the gantt view. closes odoo/odoo#53902 Task: 2284779 Related: odoo/enterprise#11563 Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
This commit is contained in:
committed by
Julien Mougenot
co-authored by
Mathieu Duckerts-Antoine
Mohammed Shekha
parent
26633ea8bb
commit
bb9ef00452
@@ -132,6 +132,26 @@ return mvc.Renderer.extend({
|
||||
await this._renderView();
|
||||
this._suppressFocusableElements();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @param {Object} context
|
||||
*/
|
||||
_renderNoContentHelper: function (context) {
|
||||
let templateName;
|
||||
if (!context && this.noContentHelp) {
|
||||
templateName = "web.ActionHelper";
|
||||
context = { noContentHelp: this.noContentHelp };
|
||||
} else {
|
||||
templateName = "web.NoContentHelper";
|
||||
}
|
||||
const template = document.createElement('template');
|
||||
// FIXME: retrieve owl qweb instance via the env set on Component s.t.
|
||||
// it also works in the tests (importing 'web.env' wouldn't). This
|
||||
// won't be necessary as soon as this will be written in owl.
|
||||
const owlQWeb = owl.Component.env.qweb;
|
||||
template.innerHTML = owlQWeb.renderToString(templateName, context);
|
||||
this.el.append(template.content.firstChild);
|
||||
},
|
||||
/**
|
||||
* Actual rendering. This method is meant to be overridden by concrete
|
||||
* renderers.
|
||||
|
||||
@@ -761,22 +761,6 @@ var BasicRenderer = AbstractRenderer.extend(WidgetAdapterMixin, {
|
||||
|
||||
return $el;
|
||||
},
|
||||
/**
|
||||
* Renders the nocontent helper.
|
||||
*
|
||||
* This method is a helper for renderers that want to display a help
|
||||
* message when no content is available.
|
||||
*
|
||||
* @private
|
||||
* @returns {jQueryElement}
|
||||
*/
|
||||
_renderNoContentHelper: function () {
|
||||
var $noContent =
|
||||
$('<div>').html(this.noContentHelp).addClass('o_nocontent_help');
|
||||
return $('<div>')
|
||||
.addClass('o_view_nocontent')
|
||||
.append($noContent);
|
||||
},
|
||||
/**
|
||||
* Instantiate custom widgets
|
||||
*
|
||||
|
||||
@@ -895,25 +895,6 @@ return AbstractRenderer.extend({
|
||||
options: options,
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_renderNoContentHelper: function (context) {
|
||||
let templateName;
|
||||
if (!context && this.noContentHelp) {
|
||||
templateName = "web.ActionHelper";
|
||||
context = { noContentHelp: this.noContentHelp };
|
||||
} else {
|
||||
templateName = "web.NoContentHelper";
|
||||
}
|
||||
const template = document.createElement('template');
|
||||
// FIXME: retrieve owl qweb instance via the env set on Component s.t.
|
||||
// it also works in the tests (importing 'web.env' wouldn't). This won't
|
||||
// be necessary as soon as this rendering will be written in owl.
|
||||
const OwlQweb = owl.Component.env.qweb;
|
||||
template.innerHTML = OwlQweb.renderToString(templateName, context);
|
||||
this.el.append(template.content.firstChild);
|
||||
},
|
||||
/**
|
||||
* create pie chart
|
||||
*
|
||||
|
||||
@@ -490,7 +490,7 @@ var KanbanRenderer = BasicRenderer.extend({
|
||||
var $noContentHelper = this.$('.o_view_nocontent');
|
||||
|
||||
if (displayNoContentHelper && !$noContentHelper.length) {
|
||||
this.$el.append(this._renderNoContentHelper());
|
||||
this._renderNoContentHelper();
|
||||
}
|
||||
if (!displayNoContentHelper && $noContentHelper.length) {
|
||||
$noContentHelper.remove();
|
||||
|
||||
@@ -1114,7 +1114,7 @@ var ListRenderer = BasicRenderer.extend({
|
||||
|
||||
// display the no content helper if necessary
|
||||
if (!this._hasContent() && !!this.noContentHelp) {
|
||||
this.$el.append(this._renderNoContentHelper());
|
||||
this._renderNoContentHelper();
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user