Browse Source

[9.0][ADD] Menu technical info (#554)

* [ADD] Initial commit

[ADD] Bootstrap tooltip

[ADD] Readme

[FIX] Readme grammar

* [FIX] cursos -> cursor

* [FIX] EOL and js requirement

* [FIX] New line, clean up js
pull/566/head
Dennis Sluijk 8 years ago
committed by Moises Lopez - https://www.vauxoo.com/
parent
commit
f7b63c0e19
  1. 51
      menu_technical_info/README.rst
  2. 3
      menu_technical_info/__init__.py
  3. 17
      menu_technical_info/__openerp__.py
  4. 33
      menu_technical_info/static/src/js/menu_technical_info.js
  5. 13
      menu_technical_info/views/menu_technical_info_templates.xml

51
menu_technical_info/README.rst

@ -0,0 +1,51 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
===================
Menu Technical Info
===================
This module extends the debug mode. When debug mode is enabled the XML ID is shown while the cursor is hovering over a menu item.
Usage
=====
#. Click on 'About';
#. click on 'Activate the developer mode';
#. hover over any menu item.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Dennis Sluijk <d.sluijk@onestein.nl>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

3
menu_technical_info/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

17
menu_technical_info/__openerp__.py

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# © 2016 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Menu Technical Info',
'category': 'Administration',
'version': '9.0.1.0.0',
'author': 'Onestein, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'website': 'http://www.onestein.eu',
'depends': ['web'],
'data': [
'views/menu_technical_info_templates.xml',
],
'summary': "Fast way to look up technical info about menu item."
}

33
menu_technical_info/static/src/js/menu_technical_info.js

@ -0,0 +1,33 @@
odoo.define('menu_technical_info.Menu', function (require) {
"use strict";
var $ = require('$'),
Menu = require('web.Menu'),
Model = require('web.Model');
Menu.include({
start: function() {
var self = this;
var res = this._super.apply(this, arguments);
this.debug = ($.deparam($.param.querystring()).debug !== undefined);
this.$secondary_menus.find('[data-menu]').hover(function() {
self.load_xml_id(this);
});
this.$el.find('a[data-menu]').hover(function() {
self.load_xml_id(this);
});
return res;
},
load_xml_id: function(menu_item) {
if(!this.debug) return;
var $menu_item = $(menu_item);
if($menu_item.is('[title]')) return;
var ir_model_data = new Model('ir.model.data');
var id = $menu_item.data('menu');
ir_model_data.query(['module', 'name']).filter([['res_id', '=', id],['model', '=', 'ir.ui.menu']]).first().then(function(menu) {
$menu_item.tooltip({
title: menu.module + '.' + menu.name
}).tooltip('show');
});
}
});
});

13
menu_technical_info/views/menu_technical_info_templates.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" name="menu_technical_info assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script src="/menu_technical_info/static/src/js/menu_technical_info.js"></script>
</xpath>
</template>
<template id="menu_secondary" name="menu_technical_info menu_secondary" inherit_id="web.menu_secondary">
<xpath expr="//div[@class='oe_secondary_menu_section']" position="attributes">
<attribute name="t-att-data-menu">menu['id']</attribute>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save