some improvements when editing metadata
This commit is contained in:
parent
408af96aa2
commit
c6093f9cdf
1 changed files with 22 additions and 20 deletions
|
@ -458,27 +458,29 @@ pandora.ui.infoView = function(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function editMetadata(key, value) {
|
function editMetadata(key, value) {
|
||||||
var edit = {id: data.id};
|
if (value != data[key]) {
|
||||||
if (key == 'title') {
|
var edit = {id: data.id};
|
||||||
Ox.extend(edit, parseTitle(value));
|
if (key == 'title') {
|
||||||
} else if (key == 'director' || key == 'country') {
|
Ox.extend(edit, parseTitle(value));
|
||||||
edit[key] = value.split(', ');
|
} else if (key == 'director' || key == 'country') {
|
||||||
} else {
|
edit[key] = value.split(', ');
|
||||||
edit[key] = value;
|
} else {
|
||||||
}
|
edit[key] = value;
|
||||||
pandora.api.edit(edit, function(result) {
|
|
||||||
if (result.data.id != data.id) {
|
|
||||||
Ox.Request.clearCache(); // fixme: too much
|
|
||||||
pandora.UI.set({item: result.data.id});
|
|
||||||
pandora.$ui.browser.value(data.id, 'id', result.data.id);
|
|
||||||
}
|
}
|
||||||
// FIXME: value function should accept {k: v, ...}
|
pandora.api.edit(edit, function(result) {
|
||||||
pandora.$ui.browser.value(result.data.id, 'title', result.data.title);
|
if (result.data.id != data.id) {
|
||||||
pandora.$ui.browser.value(result.data.id, 'director', result.data.director);
|
Ox.Request.clearCache(); // fixme: too much
|
||||||
pandora.$ui.browser.value(result.data.id, 'country', result.data.country);
|
pandora.UI.set({item: result.data.id});
|
||||||
pandora.$ui.browser.value(result.data.id, 'year', result.data.year);
|
pandora.$ui.browser.value(data.id, 'id', result.data.id);
|
||||||
//pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser());
|
}
|
||||||
});
|
// FIXME: value function should accept {k: v, ...}
|
||||||
|
pandora.$ui.browser.value(result.data.id, 'title', result.data.title);
|
||||||
|
pandora.$ui.browser.value(result.data.id, 'director', result.data.director);
|
||||||
|
pandora.$ui.browser.value(result.data.id, 'country', result.data.country);
|
||||||
|
pandora.$ui.browser.value(result.data.id, 'year', result.data.year);
|
||||||
|
//pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatKey(key, isStatistics) {
|
function formatKey(key, isStatistics) {
|
||||||
|
|
Loading…
Reference in a new issue