update page change dialog handler
This commit is contained in:
parent
04a2e41bc6
commit
ef185073aa
1 changed files with 19 additions and 19 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue