Instantly share code, notes, and snippets.
Created
June 30, 2015 12:43
-
Star
(0)
0
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save nbessi/00dbb32768f9bc9e677d to your computer and use it in GitHub Desktop.
Toggle left panel in Odoo 8 and add a widget button in menubar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openerp.web.Menu.include({ | |
/** | |
* Enable left menu to be toggled | |
*/ | |
show_nav_bar: function() { | |
var nav_bar = $('.oe_leftbar'); | |
nav_bar.css('display', 'table-cell'); | |
}, | |
hide_nav_bar: function() { | |
var nav_bar = $('.oe_leftbar'); | |
nav_bar.css('display', 'none'); | |
}, | |
bind_menu: function() { | |
var self = this; | |
self._super(); | |
var toggle_button = $(document.createElement('span')); | |
toggle_button.append('☰'); | |
toggle_button.css('color', 'white'); | |
toggle_button.css('float', 'left'); | |
toggle_button.css('cursor', 'pointer'); | |
toggle_button.css('padding-top', '5px'); | |
toggle_button.css('padding-right', '10px'); | |
toggle_button.click(function(e){ | |
e.stopImmediatePropagation(); | |
var nav_bar = $('.oe_leftbar'); | |
if (nav_bar.css('display') == 'none') { | |
self.show_nav_bar(); | |
} else { | |
self.hide_nav_bar(); | |
} | |
}); | |
$('#oe_main_menu_placeholder').prepend(toggle_button); | |
}, | |
menu_click: function(id, needaction) { | |
var self = this; | |
self._super(id, needaction); | |
self.show_nav_bar(); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment