update indiancinema info view

This commit is contained in:
rolux 2013-02-27 21:24:13 +05:30
parent 1a162594c5
commit 810c117ca9

View file

@ -131,6 +131,8 @@ pandora.ui.infoView = function(data) {
$minutes, $minutes,
$imdb,
$descriptions, $descriptions,
$statistics = $('<div>') $statistics = $('<div>')
@ -235,6 +237,10 @@ pandora.ui.infoView = function(data) {
renderGroup(['imdbId']); renderGroup(['imdbId']);
if (canEdit) {
updateIMDb();
}
if (data.summary || canEdit) { if (data.summary || canEdit) {
Ox.EditableContent({ Ox.EditableContent({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
@ -454,6 +460,8 @@ pandora.ui.infoView = function(data) {
if (Ox.contains(nameKeys, key)) { if (Ox.contains(nameKeys, key)) {
names = getNames(); names = getNames();
renderDescriptions(); renderDescriptions();
} else if (key == 'imdbId') {
updateIMDb();
} }
}); });
} }
@ -737,6 +745,9 @@ pandora.ui.infoView = function(data) {
.html('&nbsp;min') .html('&nbsp;min')
[data.runtime ? 'show' : 'hide']() [data.runtime ? 'show' : 'hide']()
.appendTo($element); .appendTo($element);
} else if (key == 'imdbId') {
$imdb = $('<span>')
.appendTo($element);
} }
} }
}); });
@ -933,6 +944,27 @@ pandora.ui.infoView = function(data) {
pandora.UI.set({infoIconSize: iconSize}); pandora.UI.set({infoIconSize: iconSize});
} }
function updateIMDb() {
if (data.imdbId) {
pandora.api.find({
query: {
conditions: [{key: 'imdbId', operator: '=', value: data.imdbId}]
}
}, function(result) {
if (result.data.items == 1) {
$imdb.empty();
} else {
$imdb.html(
'&nbsp;(<a href="/imdbId=' + data.imdbId + '">'
+ result.data.items + ' duplicates</a>)'
);
}
});
} else {
$imdb.empty();
}
}
that.reload = function() { that.reload = function() {
var src = src = '/' + data.id + '/' + ( var src = src = '/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'