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) {
|
||||
var edit = {id: data.id};
|
||||
if (key == 'title') {
|
||||
Ox.extend(edit, parseTitle(value));
|
||||
} else if (key == 'director' || key == 'country') {
|
||||
edit[key] = value.split(', ');
|
||||
} 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);
|
||||
if (value != data[key]) {
|
||||
var edit = {id: data.id};
|
||||
if (key == 'title') {
|
||||
Ox.extend(edit, parseTitle(value));
|
||||
} else if (key == 'director' || key == 'country') {
|
||||
edit[key] = value.split(', ');
|
||||
} else {
|
||||
edit[key] = value;
|
||||
}
|
||||
// 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());
|
||||
});
|
||||
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.$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) {
|
||||
|
|
Loading…
Reference in a new issue