mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD] help_contextual_popup
This commit is contained in:
committed by
David Beal
parent
63e82b0b83
commit
681700adea
43
help_contextual_popup/static/src/js/popup_help.js
Normal file
43
help_contextual_popup/static/src/js/popup_help.js
Normal file
@@ -0,0 +1,43 @@
|
||||
openerp.help_contextual_popup = function(instance, local) {
|
||||
|
||||
var _t = instance.web._t;
|
||||
instance.web.ViewManager.include({
|
||||
|
||||
do_create_view: function(view_type) {
|
||||
var self = this;
|
||||
var res = self._super(view_type);
|
||||
self.$el.find('span.view_help').each(function () {
|
||||
var $elem = $(this);
|
||||
if ($elem.data('click-init')) {
|
||||
return true;
|
||||
}
|
||||
$elem.data('click-init', true);
|
||||
|
||||
var help_html = '';
|
||||
if (self.action.help) {
|
||||
help_html += '<h3>Odoo Help</h3>'
|
||||
help_html += '<div id="erp_help">' + self.action.help + '</div>';
|
||||
}
|
||||
if (self.action.custom_help) {
|
||||
help_html += '<h3>Specific Help</h3>'
|
||||
help_html += '<div id="custom_help">' + self.action.custom_help + '</div>'
|
||||
}
|
||||
|
||||
$elem.on('click', function(e) {
|
||||
|
||||
new instance.web.Dialog(self, {
|
||||
size: 'medium',
|
||||
title: _t("Help: ") + self.action.name,
|
||||
buttons: [
|
||||
{text: _t("Ok"), click: function() { this.parents('.modal').modal('hide');}}
|
||||
]
|
||||
}, help_html).open(); // self.action.res_model
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
return res;
|
||||
},
|
||||
});
|
||||
}
|
||||
8
help_contextual_popup/static/src/xml/popup_help.xml
Normal file
8
help_contextual_popup/static/src/xml/popup_help.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates>
|
||||
<t t-name="ViewManagerAction" t-extend="ViewManagerAction">
|
||||
<t t-jquery="h2.oe_view_title" t-operation="before">
|
||||
<span class="oe_button view_help">?</span>
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user