diff --git a/web_menu_collapsible/README.rst b/web_menu_collapsible/README.rst new file mode 100644 index 00000000..d83051ed --- /dev/null +++ b/web_menu_collapsible/README.rst @@ -0,0 +1,67 @@ +.. 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 + +================ +Collapsible menu +================ + +This module makes all menus collapsible for all users. + +Second level menus are collapsed by default. + +.. image:: /web_menu_collapsible/static/description/menu_collapsible_1.png + :alt: In case first level menu is collapsed, click it to expand. + +.. image:: /web_menu_collapsible/static/description/menu_collapsible_2.png + :alt: In case first level menu is expanded, click it to collapse. + +Configuration +============= + +No configuration is needed. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/162/9.0 + +Known issues / Roadmap +====================== + +* The visual hint is initially in state 'collapsed' when is actually 'expanded' (this is Odoo's menu standard mechanism). + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Dennis Sluijk + +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. \ No newline at end of file diff --git a/web_menu_collapsible/__init__.py b/web_menu_collapsible/__init__.py new file mode 100644 index 00000000..3bf7ea73 --- /dev/null +++ b/web_menu_collapsible/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# © 2016 Onestein () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/web_menu_collapsible/__openerp__.py b/web_menu_collapsible/__openerp__.py new file mode 100644 index 00000000..36913aa2 --- /dev/null +++ b/web_menu_collapsible/__openerp__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# © 2016 Onestein () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Collapsible menu', + 'license': 'AGPL-3', + 'images': [], + 'summary': 'Foldable second level Odoo menu', + 'author': 'Onestein,Odoo Community Association (OCA)', + 'website': 'http://www.onestein.eu', + 'category': 'Web', + 'version': '9.0.1.0.0', + 'depends': ['web'], + 'data': [ + 'templates/menu_collapsible.xml', + ], +} diff --git a/web_menu_collapsible/static/description/icon.png b/web_menu_collapsible/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_menu_collapsible/static/description/icon.png differ diff --git a/web_menu_collapsible/static/description/menu_collapsible_1.png b/web_menu_collapsible/static/description/menu_collapsible_1.png new file mode 100644 index 00000000..341e31b9 Binary files /dev/null and b/web_menu_collapsible/static/description/menu_collapsible_1.png differ diff --git a/web_menu_collapsible/static/description/menu_collapsible_2.png b/web_menu_collapsible/static/description/menu_collapsible_2.png new file mode 100644 index 00000000..104e6996 Binary files /dev/null and b/web_menu_collapsible/static/description/menu_collapsible_2.png differ diff --git a/web_menu_collapsible/static/src/css/menu_collapsible.css b/web_menu_collapsible/static/src/css/menu_collapsible.css new file mode 100644 index 00000000..d8f6e2c1 --- /dev/null +++ b/web_menu_collapsible/static/src/css/menu_collapsible.css @@ -0,0 +1,43 @@ +.oe_secondary_menu_section { + height: 26px; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.oe_secondary_menu_section.oe_menu_toggler { + margin-left: 18px; +} + +.oe_secondary_submenu > li > a.oe_menu_leaf, +.oe_secondary_submenu > li > a.oe_menu_toggler { + padding-left: 27px; +} + +.oe_secondary_menu_section.oe_menu_toggler::before { + width: 0; + height: 0; + display: inline-block; + content: "&darr"; + text-indent: -99999px; + vertical-align: top; + margin-left: -12px; + margin-top: 4px; + margin-right: 4px; + border-top: 4px solid transparent; + border-bottom: 4px solid transparent; + border-left: 4px solid #4c4c4c; + filter: alpha(opacity=50); + opacity: 0.5; +} + +.oe_secondary_menu_section.oe_menu_toggler.oe_menu_opened::before { + margin-top: 6px; + margin-left: -16px; + margin-right: 4px; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid #4c4c4c; +} diff --git a/web_menu_collapsible/static/src/js/menu_collapsible.js b/web_menu_collapsible/static/src/js/menu_collapsible.js new file mode 100644 index 00000000..35b8fb55 --- /dev/null +++ b/web_menu_collapsible/static/src/js/menu_collapsible.js @@ -0,0 +1,23 @@ +odoo.define('web_menu_collapsible.Menu', function(require) { +"use strict"; + var $ = require('$'), + Menu = require('web.Menu'); + + Menu.include({ + start: function() { + var self = this; + $(".oe_secondary_submenu").hide(); + $(".oe_secondary_menu_section").each(function() { + if($(this).next().hasClass('oe_secondary_submenu')) { + $(this).unbind("click"); + $(this).click(self.section_clicked); + $(this).addClass('oe_menu_toggler'); + } + }); + return this._super.apply(this, arguments); + }, + section_clicked: function() { + $(this).toggleClass('oe_menu_opened').next().toggle(); + } + }); +}); diff --git a/web_menu_collapsible/templates/menu_collapsible.xml b/web_menu_collapsible/templates/menu_collapsible.xml new file mode 100644 index 00000000..04c5dbc6 --- /dev/null +++ b/web_menu_collapsible/templates/menu_collapsible.xml @@ -0,0 +1,9 @@ + + + +