update indiancinema info view

This commit is contained in:
rolux 2013-02-27 10:46:02 +00:00
parent 02e5ed6faf
commit 8a6235b2b5

View file

@ -127,6 +127,10 @@ pandora.ui.infoView = function(data) {
}) })
.appendTo($data.$element), .appendTo($data.$element),
$alternativeTitles,
$minutes,
$descriptions, $descriptions,
$statistics = $('<div>') $statistics = $('<div>')
@ -232,17 +236,16 @@ pandora.ui.infoView = function(data) {
renderGroup(['imdbId']); renderGroup(['imdbId']);
if (data.summary || canEdit) { if (data.summary || canEdit) {
Ox.Editable({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
editable: canEdit, editable: canEdit,
maxHeight: Infinity,
placeholder: formatLight('No Summary'), placeholder: formatLight('No Summary'),
tooltip: canEdit ? getTooltip : '', tooltip: canEdit ? getTooltip : '',
type: 'textarea', type: 'textarea',
value: data.summary || '' value: data.summary || ''
}) })
.css(css) .css(css)
.css({marginTop: '8px'}) .css({marginTop: '12px'})
.bindEvent({ .bindEvent({
submit: function(data) { submit: function(data) {
editMetadata('summary', data.value); editMetadata('summary', data.value);
@ -339,8 +342,7 @@ pandora.ui.infoView = function(data) {
.css({marginBottom: '4px'}) .css({marginBottom: '4px'})
.append(formatKey('Notes', 'statistics')) .append(formatKey('Notes', 'statistics'))
.append( .append(
Ox.Editable({ Ox.EditableContent({
height: 128,
placeholder: formatLight('No notes'), placeholder: formatLight('No notes'),
tooltip: getTooltip, tooltip: getTooltip,
type: 'textarea', type: 'textarea',
@ -406,10 +408,13 @@ pandora.ui.infoView = function(data) {
edit[key] = value ? value.split('; ').map(function(value) { edit[key] = value ? value.split('; ').map(function(value) {
return [value, []]; return [value, []];
}) : []; }) : [];
data[key] = edit[key];
$alternativeTitles.html(formatKey(key));
} else if (key == 'year') { } else if (key == 'year') {
edit[key] = value ? parseInt(value) : ''; edit[key] = value ? parseInt(value) : '';
} else if (key == 'runtime') { } else if (key == 'runtime') {
edit[key] = value ? parseInt(value) * 60 : ''; edit[key] = value ? parseInt(value) * 60 : '';
$minutes[value ? 'show' : 'hide']();
} else if (listKeys.indexOf(key) > -1) { } else if (listKeys.indexOf(key) > -1) {
edit[key] = value ? value.split(', ') : []; edit[key] = value ? value.split(', ') : [];
} else { } else {
@ -449,8 +454,6 @@ pandora.ui.infoView = function(data) {
if (Ox.contains(nameKeys, key)) { if (Ox.contains(nameKeys, key)) {
names = getNames(); names = getNames();
renderDescriptions(); renderDescriptions();
} else if (key == 'namedescription') {
// ...
} }
}); });
} }
@ -502,13 +505,13 @@ pandora.ui.infoView = function(data) {
function formatValue(key, value) { function formatValue(key, value) {
var ret; var ret;
if (key == 'imdbId') { if (nameKeys.indexOf(key) > -1) {
ret = '<a href="http://www.imdb.com/title/tt'
+ value + '">' + value + '</a>';
} else if (nameKeys.indexOf(key) > -1) {
ret = formatLink(value.split(', '), 'name'); ret = formatLink(value.split(', '), 'name');
} else if (listKeys.indexOf(key) > -1 || key == 'year') { } else if (listKeys.indexOf(key) > -1 || key == 'year') {
ret = formatLink(value.split(', '), key); ret = formatLink(value.split(', '), key);
} else if (key == 'imdbId') {
ret = '<a href="http://www.imdb.com/title/tt'
+ value + '">' + value + '</a>';
} else { } else {
ret = value; ret = value;
} }
@ -661,7 +664,7 @@ pandora.ui.infoView = function(data) {
if (canEdit || value.description) { if (canEdit || value.description) {
$('<div>') $('<div>')
.css(css) .css(css)
.css({marginTop: '8px', fontWeight: 'bold'}) .css({marginTop: '12px', fontWeight: 'bold'})
.html( .html(
formatLink(value.name, 'name') formatLink(value.name, 'name')
+ ' (' + value.keys.map(function(key) { + ' (' + value.keys.map(function(key) {
@ -669,11 +672,10 @@ pandora.ui.infoView = function(data) {
}).join(', ') + ')' }).join(', ') + ')'
) )
.appendTo($descriptions); .appendTo($descriptions);
Ox.Editable({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
editable: canEdit, editable: canEdit,
maxHeight: Infinity, placeholder: formatLight('No Description'),
placeholder: 'No description',
tooltip: canEdit ? getTooltip : '', tooltip: canEdit ? getTooltip : '',
type: 'textarea', type: 'textarea',
value: value.description || '' value: value.description || ''
@ -703,7 +705,15 @@ pandora.ui.infoView = function(data) {
if ($element.children().length) { if ($element.children().length) {
$('<span>').html('; ').appendTo($element); $('<span>').html('; ').appendTo($element);
} }
$('<span>').html(formatKey(key)).appendTo($element); if (key == 'alternativeTitles') {
$alternativeTitles = $('<span>')
.html(formatKey(key))
.appendTo($element);
} else {
$('<span>')
.html(formatKey(key))
.appendTo($element);
}
Ox.EditableContent({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
format: function(value) { format: function(value) {
@ -714,13 +724,19 @@ pandora.ui.infoView = function(data) {
value: getValue(key, data[key]) value: getValue(key, data[key])
}) })
.bindEvent({ .bindEvent({
edit: function() {
key == 'runtime' && $minutes.show();
},
submit: function(data) { submit: function(data) {
editMetadata(key, data.value); editMetadata(key, data.value);
} }
}) })
.appendTo($element); .appendTo($element);
if (key == 'runtime') { if (key == 'runtime') {
$('<span>').html('&nbsp;min').appendTo($element); $minutes = $('<span>')
.html('&nbsp;min')
[data.runtime ? 'show' : 'hide']()
.appendTo($element);
} }
} }
}); });