menu: 'side' -> 'edge'

This commit is contained in:
rolux 2014-01-16 12:37:21 +05:30
parent f3d5a739a3
commit 32d32d218e
3 changed files with 9 additions and 9 deletions

View file

@ -154,6 +154,7 @@ Ox.Select = function(options, self) {
.appendTo(that);
self.$menu = Ox.Menu({
edge: 'bottom',
element: self.$title || self.$button,
id: self.options.id + 'Menu',
items: [{
@ -163,7 +164,6 @@ Ox.Select = function(options, self) {
min: self.options.min
}],
maxWidth: self.options.maxWidth,
side: 'bottom', // FIXME: should be edge
size: self.options.size
})
.bindEvent({

View file

@ -3,6 +3,7 @@
/*@
Ox.Menu <f> Menu Object
options <o> Options object
edge <s> open to 'bottom' or 'right'
element <o> the element the menu is attached to
id <s> the menu id
items <a> array of menu items
@ -12,7 +13,6 @@ Ox.Menu <f> Menu Object
top <n> top
parent <o> the supermenu, if any
selected <b> the position of the selected item
side <s> open to 'bottom' or 'right'
size <s> 'large', 'medium' or 'small'
self <o> Shared private variable
([options[, self]]) -> <o:Ox.Element> Menu Object
@ -33,6 +33,7 @@ Ox.Menu = function(options, self) {
self = self || {};
var that = Ox.Element({}, self)
.defaults({
edge: 'bottom',
element: null,
id: '',
items: [],
@ -44,7 +45,6 @@ Ox.Menu = function(options, self) {
},
parent: null,
selected: -1,
side: 'bottom', // FIXME: should be 'edge'
size: 'medium' // fixme: remove
})
.options(options || {})
@ -58,7 +58,7 @@ Ox.Menu = function(options, self) {
}
})
.addClass(
'OxMenu Ox' + Ox.toTitleCase(self.options.side) +
'OxMenu Ox' + Ox.toTitleCase(self.options.edge) +
' Ox' + Ox.toTitleCase(self.options.size)
)
.on({
@ -338,6 +338,7 @@ Ox.Menu = function(options, self) {
); // fixme: jquery bug when passing {position: position}? does not return the object?;
if (item.items) {
that.submenus[item.id] = Ox.Menu({
edge: 'right',
element: that.items[position],
id: Ox.toCamelCase(self.options.id + '/' + item.id),
items: item.items,
@ -347,7 +348,6 @@ Ox.Menu = function(options, self) {
top: -4
},
parent: that,
side: 'right',
size: self.options.size
});
}
@ -797,10 +797,10 @@ Ox.Menu = function(options, self) {
width = self.options.element.outerWidth(),
height = self.options.element.outerHeight(),
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()
),
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?
menuMaxHeight = Math.floor(Ox.UI.$window.height() - top - 16);
if (self.options.parent) {

View file

@ -85,11 +85,11 @@ Ox.MenuButton = function(options, self) {
.appendTo(that);
self.$menu = Ox.Menu({
edge: 'bottom', // FIXME: should be edge
element: self.$title || self.$button,
id: self.options.id + 'Menu',
items: self.options.items,
maxWidth: self.options.maxWidth,
side: 'bottom' // FIXME: should be edge
maxWidth: self.options.maxWidth
})
.bindEvent({
change: changeMenu,