fix metadata update (empty values)

This commit is contained in:
rlx 2016-01-24 19:02:54 +05:30
parent 38b9c433bc
commit 49fa35ae95
1 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,8 @@ oml.ui.identifyDialog = function(data) {
var ui = oml.user.ui,
arrayKeys = ['author', 'publisher', 'place', 'language'],
$form = Ox.Element(),
$findSelect = Ox.Select({
@ -161,10 +163,19 @@ oml.ui.identifyDialog = function(data) {
oml.api.edit(Ox.extend({
id: data.id
}, Ox.filter(
$list.value($list.options('selected')[0]),
Ox.map(
$list.value($list.options('selected')[0]),
function(value, key) {
return value || (
$updateSelect.value() == 'replace'
? (Ox.contains(arrayKeys, key) ? [] : '')
: data[key]
);
}
),
function(value, key) {
return Ox.contains($list.options('keys'), key)
&& value != data[key]
&& !Ox.isEqual(value, data[key]);
}
)), function(result) {
Ox.Request.clearCache('find');