[IMP] style fixes, just .data() jquery method instead of .attr('data-*'): shorter and parses integers without having the need to do so manually

[Every attempt is made to convert the string to a JavaScript value (this includes booleans, numbers, objects, arrays, and null) otherwise it is left as a string. To retrieve the value's attribute as a string without any attempt to convert it, use the attr() method. ]

bzr revid: xmo@openerp.com-20110325132115-25ey6y08zc1bjk1q
This commit is contained in:
Xavier Morel
2011-03-25 14:21:15 +01:00
parent 78f759622f
commit 47fa3b4a5f
+7 -6
View File
@@ -455,21 +455,22 @@ openerp.base.Menu = openerp.base.Controller.extend({
this.on_ready();
},
on_menu_click: function(ev, id) {
var id = id || 0, $menu, $parent, $secondary;
id = id || 0;
var $menu, $parent, $secondary;
if (id) {
// We can manually activate a menu with it's id (for hash url mapping)
$menu = $('a[data-menu=' + id + ']', this.$element);
$menu = this.$element.find('a[data-menu=' + id + ']');
if (!$menu.length) {
$menu = $('a[data-menu=' + id + ']', this.$secondary_menu);
$menu = this.$secondary_menu.find('a[data-menu=' + id + ']');
}
} else {
$menu = $(ev.currentTarget);
id = parseInt($menu.attr('data-menu'));
id = $menu.data('menu');
}
if (this.$secondary_menu.has($menu).length) {
$secondary = $menu.parents('.menu_accordion');
var parent_id = $secondary.attr('data-menu-parent');
$parent = $('a[data-menu=' + parent_id + ']', this.$element);
$parent = this.$element.find('a[data-menu=' + $secondary.data('menu-parent') + ']');
} else {
$parent = $menu;
$secondary = this.$secondary_menu.find('.menu_accordion[data-menu-parent=' + $menu.attr('data-menu') + ']');