fix bugs in id dialog

This commit is contained in:
rolux 2013-03-02 15:31:50 +05:30
parent 06ac4b9c6e
commit b0c80a5f47

View file

@ -90,9 +90,21 @@ pandora.ui.idDialog = function(data) {
}); });
pandora.api.getIds(get, function(result) { pandora.api.getIds(get, function(result) {
var checkboxes = []; var checkboxes = [];
if (!data.imdbId) {
checkboxes.push(
{
id: 'none',
title: getTitle({
id: data.imdbId,
title: data.title,
director: data.director,
year: data.year
})
}
);
}
$content = Ox.Element() $content = Ox.Element()
.css({padding: '13px', overflowY: 'auto'}); .css({padding: '13px', overflowY: 'auto'});
if (result.data.items.length) {
['title', 'director', 'year'].forEach(function(key) { ['title', 'director', 'year'].forEach(function(key) {
$input.push( $input.push(
Ox.Input({ Ox.Input({
@ -119,19 +131,6 @@ pandora.ui.idDialog = function(data) {
$('<div>') $('<div>')
.css({width: '1px', height: '8px'}) .css({width: '1px', height: '8px'})
.appendTo($content); .appendTo($content);
if (!data.imdbId) {
checkboxes.push(
{
id: 'none',
title: getTitle({
id: data.imdbId,
title: data.title,
director: data.director,
year: data.year
})
}
);
}
( (
data.imdbId data.imdbId
&& Ox.getIndexById(result.data.items, data.imdbId) == -1 && Ox.getIndexById(result.data.items, data.imdbId) == -1
@ -185,17 +184,17 @@ pandora.ui.idDialog = function(data) {
), '_blank'); ), '_blank');
} }
}) })
.appendTo(elements[index]) .appendTo(elements[index]);
} }
}); });
that.options({content: $content}); that.options({content: $content});
updateButton(); updateButton();
}); });
}
}); });
} }
function getTitle(item) { function getTitle(item) {
item = Ox.clone(item, true);
if (item.id && item.id == data.imdbId) { if (item.id && item.id == data.imdbId) {
item.id = highlightTitle(item.id); item.id = highlightTitle(item.id);
} }