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