From 7865ddd95a35e1a2ad60de9023fa8506d1311c76 Mon Sep 17 00:00:00 2001 From: rlx Date: Tue, 12 Jan 2016 10:14:33 +0530 Subject: [PATCH] update edit dialog --- static/js/editDialog.js | 47 +++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/static/js/editDialog.js b/static/js/editDialog.js index 3188ebd..6b079c0 100644 --- a/static/js/editDialog.js +++ b/static/js/editDialog.js @@ -2,13 +2,17 @@ oml.ui.editDialog = function() { - var arrayKeys = [ + var ui = oml.user.ui, + arrayKeys = [ 'author', 'place', 'publisher', 'language' ], - ids = oml.user.ui.listSelection, + hasChanged = false, + ids = ui.listSelection, keys = [ - 'title', 'author', 'place', 'publisher', 'date', - 'edition', 'language', 'pages', 'description' + 'title', 'author', + 'publisher', 'place', 'date', + 'series', 'edition', 'language', 'pages', + 'categories', 'isbn', 'description', 'tableofcontents' ], mixed = ' ', separator = '; ', @@ -21,10 +25,19 @@ oml.ui.editDialog = function() { var that = Ox.Dialog({ buttons: [ Ox.Button({ + style: 'squared', title: Ox._('Done') }) .bindEvent({ 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(); } }) @@ -39,7 +52,25 @@ oml.ui.editDialog = function() { ) ]), 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(); @@ -78,7 +109,11 @@ oml.ui.editDialog = function() { : values[0]; }); that.options({ - content: oml.ui.infoView(data, isMixed) + content: oml.ui.infoView(data, isMixed).bindEvent({ + change: function() { + hasChanged = true; + } + }) }); }); }