update page change dialog handler

This commit is contained in:
rlx 2016-01-13 12:22:25 +05:30
parent 04a2e41bc6
commit ef185073aa

View file

@ -25,31 +25,31 @@ oml.ui.appPanel = function() {
setPage(ui.page);
function setPage(page, previousPage) {
var dialogs = {
appDialog: ['about', 'faq', 'terms', 'development', 'contact'],
updateDialog: ['update'],
userDialog: ['preferences', 'peers', 'transfers'],
importExportDialog: ['import', 'export']
};
// close dialogs
if (
!Ox.contains(['import', 'export'], page)
|| !Ox.contains(['import', 'export'], previousPage)
) {
if (Ox.every(dialog, function(pages) {
return !Ox.contains(pages, page);
}) && Ox.some(dialog, function(pages) {
return Ox.contains(pages, previousPage)
})) {
$('.OxDialog:visible').each(function() {
Ox.$elements[$(this).data('oxid')].close();
});
}
// open dialog
if (Ox.contains([
'welcome', 'app', 'update', 'preferences', 'users',
'notifications', 'transfers', 'help'
], page)) {
oml.$ui[page + 'Dialog'] = oml.ui[page + 'Dialog']().open();
} else if (Ox.contains(['import', 'export'], page)) {
if (
oml.$ui.importExportDialog
&& oml.$ui.importExportDialog.is(':visible')
) {
oml.$ui.importExportDialog.select(page);
} else {
oml.$ui.importExportDialog = oml.ui.importExportDialog(page).open();
// open dialogs
Ox.forEach(dialogs, function(pages, dialog) {
if (Ox.contains(pages, page) && !Ox.contains(pages, previousPage)) {
$('.OxDialog:visible').each(function() {
Ox.$elements[$(this).data('oxid')].close();
});
oml.$ui[dialog] = oml.ui[dialog]().open();
}
}
});
}
that.reload = function() {