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-25 14:05:26 +00:00
|
|
|
toggle: function(data) {
|
|
|
|
oml.UI.set({showInfo: !data.collapsed});
|
|
|
|
},
|
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',
|
2015-03-07 14:46:59 +00:00
|
|
|
'description', 'modified', 'title'
|
2014-05-04 17:26:43 +00:00
|
|
|
]
|
|
|
|
}, function(result) {
|
|
|
|
var data = result.data;
|
|
|
|
that.empty();
|
|
|
|
$('<img>')
|
2015-03-07 14:46:59 +00:00
|
|
|
.attr({src: '/' + id + '/cover128.jpg?' + data.modified})
|
2014-05-04 17:26:43 +00:00
|
|
|
.css({margin: '16px 0 8px 0'})
|
|
|
|
.appendTo(that);
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
fontWeight: 'bold'
|
|
|
|
})
|
2016-01-08 08:37:34 +00:00
|
|
|
.text(data.title || '')
|
2014-05-04 17:26:43 +00:00
|
|
|
.appendTo(that);
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
fontWeight: 'bold'
|
|
|
|
})
|
2016-01-08 08:37:34 +00:00
|
|
|
.text((data.author || []).join(', '))
|
2014-05-04 17:26:43 +00:00
|
|
|
.appendTo(that);
|
|
|
|
$('<div>')
|
|
|
|
.css({marginTop: '8px'})
|
2016-01-08 08:37:34 +00:00
|
|
|
.text(result.data.description || '')
|
2014-05-04 17:26:43 +00:00
|
|
|
.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
|
|
|
|
2015-03-07 14:46:59 +00:00
|
|
|
};
|