in icon lists, support 'info' that is not a string, but an element

This commit is contained in:
rlx 2011-09-29 06:17:50 +00:00
parent 3965eed153
commit 44a8ff015c
4 changed files with 32 additions and 8 deletions

View file

@ -1092,8 +1092,14 @@ Lists
border-radius: 4px; border-radius: 4px;
//-moz-user-select: text; //-moz-user-select: text;
//-webkit-user-select: text; //-webkit-user-select: text;
} }
.OxIconList .OxItem > .OxText > div > div,
.OxIconList .OxItem > .OxText > div > div > div {
font-size: 9px;
font-weight: bold;
text-align: center;
}
.OxTextList { .OxTextList {
top: 0; top: 0;

View file

@ -101,7 +101,6 @@
buffer = ''; buffer = '';
}, 1000); }, 1000);
Ox.print(ret);
return ret; return ret;
} }

View file

@ -42,12 +42,26 @@ Ox.IconItem = function(options, self) {
Ox.extend(self, { Ox.extend(self, {
fontSize: self.options.itemWidth == 64 ? 6 : 9, fontSize: self.options.itemWidth == 64 ? 6 : 9,
infoIsObject: Ox.isObject(self.options.info),
lineLength: self.options.itemWidth == 64 ? 15 : 23, lineLength: self.options.itemWidth == 64 ? 15 : 23,
lines: self.options.itemWidth == 64 ? 4 : 5, lines: self.options.itemWidth == 64 ? 4 : 5,
url: Ox.UI.PATH + 'png/transparent.png', url: Ox.UI.PATH + 'png/transparent.png',
}); });
self.title = formatText(self.options.title, self.lines - 1, self.lineLength);
self.title = formatText(self.options.title, self.lines - 1 - self.infoIsObject, self.lineLength);
if (!self.infoIsObject) {
self.info = formatText(self.options.info, 5 - self.title.split('<br/>').length, self.lineLength); self.info = formatText(self.options.info, 5 - self.title.split('<br/>').length, self.lineLength);
} else {
self.title = $('<div>').html(self.title);
self.info = $('<div>').append(
self.options.info.css({
width: Math.round(self.options.itemWidth / 2) + 'px',
padding: 0,
margin: '1px auto 1px auto',
textShadow: 'none'
})
);
}
that.css({ that.css({
width: self.options.itemWidth + 'px', width: self.options.itemWidth + 'px',
@ -86,11 +100,13 @@ Ox.IconItem = function(options, self) {
.css({ .css({
fontSize: self.fontSize + 'px' fontSize: self.fontSize + 'px'
}) })
.html(
self.title + '<br/><span class="OxInfo">' + self.info + '</span>'
)
.mouseenter(mouseenter) .mouseenter(mouseenter)
.mouseleave(mouseleave); .mouseleave(mouseleave);
if (!self.infoIsObject) {
that.$text.html(self.title + '<br/><span class="OxInfo">' + self.info + '</span>')
} else {
that.$text.append(self.title).append(self.info);
}
that.$reflection = $('<div>') that.$reflection = $('<div>')
.addClass('OxReflection') .addClass('OxReflection')
.css({ .css({

View file

@ -114,7 +114,10 @@ Ox.IconList = function(options, self) {
function updateKeys() { function updateKeys() {
that.$element.options({ that.$element.options({
keys: Ox.unique(Ox.merge(self.options.sort[0].key, self.options.keys)) keys: Ox.unique(Ox.merge(
self.options.sort[0].key.split(':').pop(),
self.options.keys
))
}); });
} }