From 32d32d218e4be7ac4f8c2853c33e13eb766e7604 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 16 Jan 2014 12:37:21 +0530 Subject: [PATCH] menu: 'side' -> 'edge' --- source/Ox.UI/js/Form/Select.js | 2 +- source/Ox.UI/js/Menu/Menu.js | 12 ++++++------ source/Ox.UI/js/Menu/MenuButton.js | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/Ox.UI/js/Form/Select.js b/source/Ox.UI/js/Form/Select.js index c08a523e..e52163a7 100644 --- a/source/Ox.UI/js/Form/Select.js +++ b/source/Ox.UI/js/Form/Select.js @@ -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({ diff --git a/source/Ox.UI/js/Menu/Menu.js b/source/Ox.UI/js/Menu/Menu.js index fd4d035a..64b7356b 100644 --- a/source/Ox.UI/js/Menu/Menu.js +++ b/source/Ox.UI/js/Menu/Menu.js @@ -3,6 +3,7 @@ /*@ Ox.Menu Menu Object options Options object + edge open to 'bottom' or 'right' element the element the menu is attached to id the menu id items array of menu items @@ -12,7 +13,6 @@ Ox.Menu Menu Object top top parent the supermenu, if any selected the position of the selected item - side open to 'bottom' or 'right' size 'large', 'medium' or 'small' self Shared private variable ([options[, self]]) -> 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) { diff --git a/source/Ox.UI/js/Menu/MenuButton.js b/source/Ox.UI/js/Menu/MenuButton.js index aae4eabe..6ce8f0f9 100644 --- a/source/Ox.UI/js/Menu/MenuButton.js +++ b/source/Ox.UI/js/Menu/MenuButton.js @@ -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,