Ox.Menu: fix super binding, cosmetic changes

This commit is contained in:
rlx 2014-09-22 16:03:25 +02:00
parent 53e2126ec2
commit 498c5effa2

View file

@ -327,15 +327,17 @@ Ox.Menu = function(options, self) {
items.forEach(function(item) {
var position;
if ('id' in item) {
position = that.items.length;
that.items.push(
Ox.MenuItem(Ox.extend(Ox.clone(item), {
maxWidth: self.options.maxWidth,
menu: that,
position: position = that.items.length
position: position
}))
.data('position', position)
// fixme: jquery bug when passing {position: position}? does not return the object?
.appendTo(that.$content)
); // fixme: jquery bug when passing {position: position}? does not return the object?;
);
if (item.items) {
that.submenus[item.id] = Ox.Menu({
edge: 'right',
@ -343,10 +345,7 @@ Ox.Menu = function(options, self) {
id: Ox.toCamelCase(self.options.id + '/' + item.id),
items: item.items,
mainmenu: self.options.mainmenu,
offset: {
left: 0,
top: -4
},
offset: {left: 0, top: -4},
parent: that,
size: self.options.size
});
@ -367,10 +366,7 @@ Ox.Menu = function(options, self) {
function renderLine() {
return $('<tr>').append(
$('<td>', {
'class': 'OxLine',
colspan: 5
})
$('<td>').addClass('OxLine').attr({colspan: 5})
);
}
@ -419,7 +415,7 @@ Ox.Menu = function(options, self) {
function renderSpace() {
return $('<tr>').append(
$('<td>', {'class': 'OxSpace', colspan: 5})
$('<td>').addClass('OxSpace').attr({colspan: 5})
);
}
@ -747,7 +743,7 @@ Ox.Menu = function(options, self) {
remove <f> remove
() -> <o> remove menu
@*/
self.superRemove = that.remove;
self.superRemove = that.remove.bind(that);
that.remove = function() {
Ox.forEach(that.submenus, function(submenu) {
submenu.remove();