update edit dialog

This commit is contained in:
rlx 2016-01-12 10:14:33 +05:30
parent a5ec102398
commit 7865ddd95a

View file

@ -2,13 +2,17 @@
oml.ui.editDialog = function() { oml.ui.editDialog = function() {
var arrayKeys = [ var ui = oml.user.ui,
arrayKeys = [
'author', 'place', 'publisher', 'language' 'author', 'place', 'publisher', 'language'
], ],
ids = oml.user.ui.listSelection, hasChanged = false,
ids = ui.listSelection,
keys = [ keys = [
'title', 'author', 'place', 'publisher', 'date', 'title', 'author',
'edition', 'language', 'pages', 'description' 'publisher', 'place', 'date',
'series', 'edition', 'language', 'pages',
'categories', 'isbn', 'description', 'tableofcontents'
], ],
mixed = ' ', mixed = ' ',
separator = '; ', separator = '; ',
@ -21,10 +25,19 @@ oml.ui.editDialog = function() {
var that = Ox.Dialog({ var that = Ox.Dialog({
buttons: [ buttons: [
Ox.Button({ Ox.Button({
style: 'squared',
title: Ox._('Done') title: Ox._('Done')
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
if (!ui.updateResults && hasChanged) {
oml.$ui.info.updateElement();
oml.$ui.filters.forEach(function($filter) {
$filter.reloadList();
});
oml.$ui.list.reloadList(true);
oml.$ui.browser.reloadList(true);
}
that.close(); that.close();
} }
}) })
@ -39,8 +52,26 @@ oml.ui.editDialog = function() {
) )
]), ]),
width: 512 width: 512
}),
$updateCheckbox = Ox.Checkbox({
style: 'squared',
title: Ox._('Update Results in the Background'),
value: ui.updateResults
})
.css({
float: 'left',
margin: '4px'
})
.bindEvent({
change: function(data) {
oml.UI.set({updateResults: data.value});
}
}); });
$($updateCheckbox.find('.OxButton')[0]).css({margin: 0});
$(that.find('.OxBar')[1]).append($updateCheckbox);
getMetadata(); getMetadata();
function getMetadata(callback) { function getMetadata(callback) {
@ -78,7 +109,11 @@ oml.ui.editDialog = function() {
: values[0]; : values[0];
}); });
that.options({ that.options({
content: oml.ui.infoView(data, isMixed) content: oml.ui.infoView(data, isMixed).bindEvent({
change: function() {
hasChanged = true;
}
})
}); });
}); });
} }