mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[9.0][MIG][web_menu_collapsible] (#463)
This commit is contained in:
committed by
Pedro M. Baeza
parent
a4c70c8157
commit
47cf374631
67
web_menu_collapsible/README.rst
Normal file
67
web_menu_collapsible/README.rst
Normal file
@@ -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
|
||||
<https://github.com/OCA/162/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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
|
||||
|
||||
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
web_menu_collapsible/__init__.py
Normal file
3
web_menu_collapsible/__init__.py
Normal file
@@ -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).
|
||||
18
web_menu_collapsible/__openerp__.py
Normal file
18
web_menu_collapsible/__openerp__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Onestein (<http://www.onestein.eu>)
|
||||
# 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',
|
||||
],
|
||||
}
|
||||
BIN
web_menu_collapsible/static/description/icon.png
Normal file
BIN
web_menu_collapsible/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
BIN
web_menu_collapsible/static/description/menu_collapsible_1.png
Normal file
BIN
web_menu_collapsible/static/description/menu_collapsible_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
web_menu_collapsible/static/description/menu_collapsible_2.png
Normal file
BIN
web_menu_collapsible/static/description/menu_collapsible_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
43
web_menu_collapsible/static/src/css/menu_collapsible.css
Normal file
43
web_menu_collapsible/static/src/css/menu_collapsible.css
Normal file
@@ -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;
|
||||
}
|
||||
23
web_menu_collapsible/static/src/js/menu_collapsible.js
Normal file
23
web_menu_collapsible/static/src/js/menu_collapsible.js
Normal file
@@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
9
web_menu_collapsible/templates/menu_collapsible.xml
Normal file
9
web_menu_collapsible/templates/menu_collapsible.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<template id="assets_backend_menu_collapsible" name="assets.backend.menu.collapsible" inherit_id="web.assets_backend">
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet" href="/web_menu_collapsible/static/src/css/menu_collapsible.css" />
|
||||
<script type="text/javascript" src="/web_menu_collapsible/static/src/js/menu_collapsible.js"></script>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user