Browse Source

[ADD] Module menu_collapsible 8.0 (#324)

[ADD] Module menu_collapsible 8.0
pull/458/head
Andrea Stirpe 8 years ago
committed by Pedro M. Baeza
parent
commit
ce22e5ae89
  1. 74
      web_menu_collapsible/README.rst
  2. 3
      web_menu_collapsible/__init__.py
  3. 18
      web_menu_collapsible/__openerp__.py
  4. BIN
      web_menu_collapsible/static/description/icon.png
  5. BIN
      web_menu_collapsible/static/description/menu_collapsible_1.png
  6. BIN
      web_menu_collapsible/static/description/menu_collapsible_2.png
  7. 42
      web_menu_collapsible/static/src/css/menu_collapsible.css
  8. 19
      web_menu_collapsible/static/src/js/menu_collapsible.js
  9. 11
      web_menu_collapsible/templates/menu_collapsible.xml

74
web_menu_collapsible/README.rst

@ -0,0 +1,74 @@
.. 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/8.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/web/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
<https://github.com/OCA/
web/issues/new?body=module:%20
web_menu_collapsible%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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

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

18
web_menu_collapsible/__openerp__.py

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# © 2015 ONESTEiN BV (<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 BV,Odoo Community Association (OCA)',
'website': 'http://www.onestein.eu',
'category': 'Web',
'version': '8.0.1.0.0',
'depends': ['web'],
'data': [
'templates/menu_collapsible.xml',
],
}

BIN
web_menu_collapsible/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

BIN
web_menu_collapsible/static/description/menu_collapsible_1.png

After

Width: 214  |  Height: 446  |  Size: 34 KiB

BIN
web_menu_collapsible/static/description/menu_collapsible_2.png

After

Width: 214  |  Height: 273  |  Size: 18 KiB

42
web_menu_collapsible/static/src/css/menu_collapsible.css

@ -0,0 +1,42 @@
.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;
}
.openerp .nav-pills li > a {
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;
}

19
web_menu_collapsible/static/src/js/menu_collapsible.js

@ -0,0 +1,19 @@
openerp.web_menu_collapsible = function(instance) {
instance.web.Menu.include({
self: this,
start: function() {
$(".oe_secondary_submenu").hide();
$(".oe_secondary_menu_section").unbind("click");
$(".oe_secondary_menu_section").click(this.section_clicked);
$(".oe_secondary_menu_section").each(function() {
if($(this).next().hasClass('oe_secondary_submenu')) {
$(this).addClass('oe_menu_toggler');
}
});
return this._super.apply(this, arguments);
},
section_clicked: function() {
$(this).toggleClass('oe_menu_opened').next().toggle();
}
});
};

11
web_menu_collapsible/templates/menu_collapsible.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<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>
</data>
</openerp>
Loading…
Cancel
Save