forked from 0x2620/oxjs
self.setOption ~> that.update
This commit is contained in:
parent
9ee0742b53
commit
005d50c389
56 changed files with 919 additions and 933 deletions
|
|
@ -120,10 +120,6 @@ Ox.MainMenu = function(options, self) {
|
|||
that.menus[position].remove();
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
|
||||
};
|
||||
|
||||
that.addMenuAfter = function(id) {
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -45,6 +45,15 @@ Ox.Menu = function(options, self) {
|
|||
size: 'medium' // fixme: remove
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
items: function() {
|
||||
renderItems(self.options.items);
|
||||
},
|
||||
selected: function() {
|
||||
that.$content.find('.OxSelected').removeClass('OxSelected');
|
||||
selectItem(self.options.selected);
|
||||
}
|
||||
})
|
||||
.addClass(
|
||||
'OxMenu Ox' + Ox.toTitleCase(self.options.side) +
|
||||
' Ox' + Ox.toTitleCase(self.options.size)
|
||||
|
|
@ -567,15 +576,6 @@ Ox.Menu = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'items') {
|
||||
renderItems(value);
|
||||
} else if (key == 'selected') {
|
||||
that.$content.find('.OxSelected').removeClass('OxSelected');
|
||||
selectItem(value);
|
||||
}
|
||||
}
|
||||
|
||||
/*@
|
||||
addItem <f>
|
||||
@*/
|
||||
|
|
|
|||
|
|
@ -34,6 +34,19 @@ Ox.MenuButton = function(options, self) {
|
|||
width: 'auto'
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
title: function() {
|
||||
if (self.options.type == 'text') {
|
||||
self.$title.html(self.options.title);
|
||||
} else {
|
||||
self.$button.options({title: self.options.title});
|
||||
}
|
||||
},
|
||||
width: function() {
|
||||
that.css({width: self.options.width - 2 + 'px'});
|
||||
self.$title.css({width: self.options.width - 24 + 'px'});
|
||||
}
|
||||
})
|
||||
.addClass(
|
||||
'OxSelect Ox' + Ox.toTitleCase(self.options.style)
|
||||
)
|
||||
|
|
@ -98,19 +111,6 @@ Ox.MenuButton = function(options, self) {
|
|||
that.triggerEvent('show');
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'title') {
|
||||
if (self.options.type == 'text') {
|
||||
self.$title.html(value);
|
||||
} else {
|
||||
self.$button.options({title: value});
|
||||
}
|
||||
} else if (key == 'width') {
|
||||
that.css({width: value - 2 + 'px'});
|
||||
self.$title.css({width: self.options.width - 24 + 'px'});
|
||||
}
|
||||
}
|
||||
|
||||
/*@
|
||||
checkItem <f> checkItem
|
||||
(id) -> <o> check item with id
|
||||
|
|
|
|||
|
|
@ -41,6 +41,18 @@ Ox.MenuItem = function(options, self) {
|
|||
keyboard: parseKeyboard(options.keyboard || self.defaults.keyboard),
|
||||
title: Ox.makeArray(options.title || self.defaults.title)
|
||||
}))
|
||||
.update({
|
||||
checked: function() {
|
||||
that.$status.html(self.options.checked ? Ox.UI.symbols.check : '')
|
||||
},
|
||||
disabled: function() {
|
||||
that.toggleClass('OxDisabled');
|
||||
},
|
||||
title: function() {
|
||||
self.options.title = Ox.makeArray(self.options.title);
|
||||
that.$title.html(self.options.title[0]);
|
||||
}
|
||||
})
|
||||
.addClass('OxItem' + (self.options.disabled ? ' OxDisabled' : ''))
|
||||
/*
|
||||
.attr({
|
||||
|
|
@ -124,20 +136,6 @@ Ox.MenuItem = function(options, self) {
|
|||
};
|
||||
}
|
||||
|
||||
/*@
|
||||
setOption <f> setOption
|
||||
@*/
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'checked') {
|
||||
that.$status.html(value ? Ox.UI.symbols.check : '')
|
||||
} else if (key == 'disabled') {
|
||||
that.toggleClass('OxDisabled');
|
||||
} else if (key == 'title') {
|
||||
self.options.title = Ox.makeArray(value);
|
||||
that.$title.html(self.options.title[0]);
|
||||
}
|
||||
};
|
||||
|
||||
that.toggle = function() {
|
||||
// toggle id and title
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue