2014-05-04 17:26:43 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
oml.ui.info = function() {
|
|
|
|
|
|
|
|
var ui = oml.user.ui,
|
|
|
|
|
|
|
|
that = Ox.Element()
|
|
|
|
.addClass('OxTextPage')
|
2014-05-17 11:45:57 +00:00
|
|
|
.css({
|
|
|
|
padding: '0 16px',
|
2014-05-04 17:26:43 +00:00
|
|
|
textAlign: 'center',
|
2014-05-17 11:45:57 +00:00
|
|
|
overflowY: 'auto'
|
|
|
|
})
|
|
|
|
.bindEvent({
|
2014-05-04 17:26:43 +00:00
|
|
|
oml_item: function() {
|
2014-05-17 11:45:57 +00:00
|
|
|
that.updateElement();
|
2014-05-04 17:26:43 +00:00
|
|
|
},
|
2014-05-17 11:45:57 +00:00
|
|
|
oml_listselection: function() {
|
|
|
|
that.updateElement();
|
|
|
|
}
|
|
|
|
});
|
2014-05-04 17:26:43 +00:00
|
|
|
|
2014-05-17 11:45:57 +00:00
|
|
|
that.updateElement = function() {
|
2014-05-04 17:26:43 +00:00
|
|
|
var id = ui.item || ui.listSelection[0];
|
|
|
|
if (id) {
|
|
|
|
oml.api.get({
|
|
|
|
id: id,
|
|
|
|
keys: [
|
|
|
|
'author', 'coverRatio',
|
|
|
|
'description', 'title'
|
|
|
|
]
|
|
|
|
}, function(result) {
|
|
|
|
var data = result.data;
|
|
|
|
that.empty();
|
|
|
|
$('<img>')
|
|
|
|
.attr({src: '/' + id + '/cover128.jpg'})
|
|
|
|
.css({margin: '16px 0 8px 0'})
|
|
|
|
.appendTo(that);
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
fontWeight: 'bold'
|
|
|
|
})
|
|
|
|
.html(data.title || '')
|
|
|
|
.appendTo(that);
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
fontWeight: 'bold'
|
|
|
|
})
|
|
|
|
.html((data.author || []).join(', '))
|
|
|
|
.appendTo(that);
|
|
|
|
$('<div>')
|
|
|
|
.css({marginTop: '8px'})
|
|
|
|
.html(
|
|
|
|
Ox.encodeHTMLEntities(result.data.description || '')
|
|
|
|
)
|
|
|
|
.appendTo(that);
|
|
|
|
$('<div>')
|
|
|
|
.css({height: '16px'})
|
|
|
|
.appendTo(that);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
that.empty();
|
|
|
|
}
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
2014-05-17 11:45:57 +00:00
|
|
|
return that.updateElement();
|
2014-05-04 17:26:43 +00:00
|
|
|
|
|
|
|
};
|