menu: 'side' -> 'edge'
This commit is contained in:
parent
f3d5a739a3
commit
32d32d218e
3 changed files with 9 additions and 9 deletions
|
@ -154,6 +154,7 @@ Ox.Select = function(options, self) {
|
||||||
.appendTo(that);
|
.appendTo(that);
|
||||||
|
|
||||||
self.$menu = Ox.Menu({
|
self.$menu = Ox.Menu({
|
||||||
|
edge: 'bottom',
|
||||||
element: self.$title || self.$button,
|
element: self.$title || self.$button,
|
||||||
id: self.options.id + 'Menu',
|
id: self.options.id + 'Menu',
|
||||||
items: [{
|
items: [{
|
||||||
|
@ -163,7 +164,6 @@ Ox.Select = function(options, self) {
|
||||||
min: self.options.min
|
min: self.options.min
|
||||||
}],
|
}],
|
||||||
maxWidth: self.options.maxWidth,
|
maxWidth: self.options.maxWidth,
|
||||||
side: 'bottom', // FIXME: should be edge
|
|
||||||
size: self.options.size
|
size: self.options.size
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
/*@
|
/*@
|
||||||
Ox.Menu <f> Menu Object
|
Ox.Menu <f> Menu Object
|
||||||
options <o> Options object
|
options <o> Options object
|
||||||
|
edge <s> open to 'bottom' or 'right'
|
||||||
element <o> the element the menu is attached to
|
element <o> the element the menu is attached to
|
||||||
id <s> the menu id
|
id <s> the menu id
|
||||||
items <a> array of menu items
|
items <a> array of menu items
|
||||||
|
@ -12,7 +13,6 @@ Ox.Menu <f> Menu Object
|
||||||
top <n> top
|
top <n> top
|
||||||
parent <o> the supermenu, if any
|
parent <o> the supermenu, if any
|
||||||
selected <b> the position of the selected item
|
selected <b> the position of the selected item
|
||||||
side <s> open to 'bottom' or 'right'
|
|
||||||
size <s> 'large', 'medium' or 'small'
|
size <s> 'large', 'medium' or 'small'
|
||||||
self <o> Shared private variable
|
self <o> Shared private variable
|
||||||
([options[, self]]) -> <o:Ox.Element> Menu Object
|
([options[, self]]) -> <o:Ox.Element> Menu Object
|
||||||
|
@ -33,6 +33,7 @@ Ox.Menu = function(options, self) {
|
||||||
self = self || {};
|
self = self || {};
|
||||||
var that = Ox.Element({}, self)
|
var that = Ox.Element({}, self)
|
||||||
.defaults({
|
.defaults({
|
||||||
|
edge: 'bottom',
|
||||||
element: null,
|
element: null,
|
||||||
id: '',
|
id: '',
|
||||||
items: [],
|
items: [],
|
||||||
|
@ -44,7 +45,6 @@ Ox.Menu = function(options, self) {
|
||||||
},
|
},
|
||||||
parent: null,
|
parent: null,
|
||||||
selected: -1,
|
selected: -1,
|
||||||
side: 'bottom', // FIXME: should be 'edge'
|
|
||||||
size: 'medium' // fixme: remove
|
size: 'medium' // fixme: remove
|
||||||
})
|
})
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
|
@ -58,7 +58,7 @@ Ox.Menu = function(options, self) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.addClass(
|
.addClass(
|
||||||
'OxMenu Ox' + Ox.toTitleCase(self.options.side) +
|
'OxMenu Ox' + Ox.toTitleCase(self.options.edge) +
|
||||||
' Ox' + Ox.toTitleCase(self.options.size)
|
' Ox' + Ox.toTitleCase(self.options.size)
|
||||||
)
|
)
|
||||||
.on({
|
.on({
|
||||||
|
@ -338,6 +338,7 @@ Ox.Menu = function(options, self) {
|
||||||
); // fixme: jquery bug when passing {position: position}? does not return the object?;
|
); // fixme: jquery bug when passing {position: position}? does not return the object?;
|
||||||
if (item.items) {
|
if (item.items) {
|
||||||
that.submenus[item.id] = Ox.Menu({
|
that.submenus[item.id] = Ox.Menu({
|
||||||
|
edge: 'right',
|
||||||
element: that.items[position],
|
element: that.items[position],
|
||||||
id: Ox.toCamelCase(self.options.id + '/' + item.id),
|
id: Ox.toCamelCase(self.options.id + '/' + item.id),
|
||||||
items: item.items,
|
items: item.items,
|
||||||
|
@ -347,7 +348,6 @@ Ox.Menu = function(options, self) {
|
||||||
top: -4
|
top: -4
|
||||||
},
|
},
|
||||||
parent: that,
|
parent: that,
|
||||||
side: 'right',
|
|
||||||
size: self.options.size
|
size: self.options.size
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -797,10 +797,10 @@ Ox.Menu = function(options, self) {
|
||||||
width = self.options.element.outerWidth(),
|
width = self.options.element.outerWidth(),
|
||||||
height = self.options.element.outerHeight(),
|
height = self.options.element.outerHeight(),
|
||||||
left = Ox.limit(
|
left = Ox.limit(
|
||||||
offset.left + self.options.offset.left + (self.options.side == 'bottom' ? 0 : width),
|
offset.left + self.options.offset.left + (self.options.edge == 'bottom' ? 0 : width),
|
||||||
0, Ox.UI.$window.width() - that.width()
|
0, Ox.UI.$window.width() - that.width()
|
||||||
),
|
),
|
||||||
top = offset.top + self.options.offset.top + (self.options.side == 'bottom' ? height : 0),
|
top = offset.top + self.options.offset.top + (self.options.edge == 'bottom' ? height : 0),
|
||||||
menuHeight = that.$content.outerHeight(), // fixme: why is outerHeight 0 when hidden?
|
menuHeight = that.$content.outerHeight(), // fixme: why is outerHeight 0 when hidden?
|
||||||
menuMaxHeight = Math.floor(Ox.UI.$window.height() - top - 16);
|
menuMaxHeight = Math.floor(Ox.UI.$window.height() - top - 16);
|
||||||
if (self.options.parent) {
|
if (self.options.parent) {
|
||||||
|
|
|
@ -85,11 +85,11 @@ Ox.MenuButton = function(options, self) {
|
||||||
.appendTo(that);
|
.appendTo(that);
|
||||||
|
|
||||||
self.$menu = Ox.Menu({
|
self.$menu = Ox.Menu({
|
||||||
|
edge: 'bottom', // FIXME: should be edge
|
||||||
element: self.$title || self.$button,
|
element: self.$title || self.$button,
|
||||||
id: self.options.id + 'Menu',
|
id: self.options.id + 'Menu',
|
||||||
items: self.options.items,
|
items: self.options.items,
|
||||||
maxWidth: self.options.maxWidth,
|
maxWidth: self.options.maxWidth
|
||||||
side: 'bottom' // FIXME: should be edge
|
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
change: changeMenu,
|
change: changeMenu,
|
||||||
|
|
Loading…
Reference in a new issue