format date
This commit is contained in:
parent
74b4ff34fb
commit
2075f94120
1 changed files with 9 additions and 11 deletions
|
@ -246,10 +246,8 @@ pandora.ui.infoView = function(data) {
|
||||||
clickLink: pandora.clickLink,
|
clickLink: pandora.clickLink,
|
||||||
editable: key != 'duration',
|
editable: key != 'duration',
|
||||||
format: function(value) {
|
format: function(value) {
|
||||||
return key != 'duration' ? formatValue(listKeys.indexOf(key) >= 0
|
return formatValue(listKeys.indexOf(key) >= 0
|
||||||
? value.split(', ') : value, key)
|
? value.split(', ') : value, key);
|
||||||
: value < 60 ? Math.round(value) + ' sec'
|
|
||||||
: Math.round(value / 60) + ' min';
|
|
||||||
},
|
},
|
||||||
placeholder: formatLight('unknown'),
|
placeholder: formatLight('unknown'),
|
||||||
tooltip: 'Doubleclick to edit',
|
tooltip: 'Doubleclick to edit',
|
||||||
|
@ -270,13 +268,7 @@ pandora.ui.infoView = function(data) {
|
||||||
html = [];
|
html = [];
|
||||||
['location', 'date', 'language', 'duration'].forEach(function(key) {
|
['location', 'date', 'language', 'duration'].forEach(function(key) {
|
||||||
if (data[key]) {
|
if (data[key]) {
|
||||||
html.push(
|
html.push(formatKey(key) + formatValue(data[key], key));
|
||||||
formatKey(key) + (
|
|
||||||
key != 'duration' ? formatValue(data[key], key)
|
|
||||||
: data[key] < 60 ? Math.round(data[key]) + ' sec'
|
|
||||||
: Math.round(data[key] / 60) + ' min'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('<div>').css(css).html(html.join('; ')).appendTo($center);
|
$('<div>').css(css).html(html.join('; ')).appendTo($center);
|
||||||
|
@ -555,6 +547,12 @@ pandora.ui.infoView = function(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(value, key) {
|
function formatValue(value, key) {
|
||||||
|
if(key == 'date') {
|
||||||
|
return value ? Ox.formatDate(value,
|
||||||
|
['', '%Y', '%B, %Y', '%B %e, %Y'][value.split('-').length]) : '';
|
||||||
|
} else if(key == 'duration') {
|
||||||
|
return value < 60 ? Math.round(value) + ' sec' : Math.round(value / 60) + ' min';
|
||||||
|
}
|
||||||
return (Ox.isArray(value) ? value : [value]).map(function(value) {
|
return (Ox.isArray(value) ? value : [value]).map(function(value) {
|
||||||
return key ?
|
return key ?
|
||||||
'<a href="/' + key + '==' + value + '">' + value + '</a>'
|
'<a href="/' + key + '==' + value + '">' + value + '</a>'
|
||||||
|
|
Loading…
Reference in a new issue