update main menu, app dialog, update dialog

This commit is contained in:
rlx 2016-01-13 09:46:48 +05:30
parent 53766116c9
commit 5f37f27b9d
6 changed files with 34 additions and 17 deletions

View File

@ -237,12 +237,12 @@
{"id": "welcome", "title": "Welcome"}, {"id": "welcome", "title": "Welcome"},
{"id": "app", "title": "Application", "parts": [ {"id": "app", "title": "Application", "parts": [
{"id": "about", "title": "About Open Media Library"}, {"id": "about", "title": "About Open Media Library"},
{"id": "update", "title": "Software Update"},
{"id": "faq", "title": "Frequently Asked Questions"}, {"id": "faq", "title": "Frequently Asked Questions"},
{"id": "terms", "title": "Terms and Conditions"}, {"id": "terms", "title": "Terms and Conditions"},
{"id": "development", "title": "Software Development"}, {"id": "development", "title": "Software Development"},
{"id": "contact", "title": "Send Feedback"} {"id": "contact", "title": "Send Feedback"}
]}, ]},
{"id": "update", "title": "Software Update"},
{"id": "preferences", "title": "Preferences", "parts": [ {"id": "preferences", "title": "Preferences", "parts": [
{"id": "account", "title": "Account"}, {"id": "account", "title": "Account"},
{"id": "library", "title": "Library"}, {"id": "library", "title": "Library"},

View File

@ -7,7 +7,7 @@ oml.ui.appDialog = function() {
tabs = Ox.getObjectById(oml.config.pages, 'app').parts.map(function(tab) { tabs = Ox.getObjectById(oml.config.pages, 'app').parts.map(function(tab) {
return { return {
id: tab.id, id: tab.id,
title: tab.title.replace(/ Open Media Library$/, ''), title: tab.title,
selected: tab.id == ui.part.app selected: tab.id == ui.part.app
}; };
}), }),
@ -142,8 +142,20 @@ oml.ui.appDialog = function() {
that = Ox.Dialog({ that = Ox.Dialog({
buttons: [ buttons: [
Ox.Button({
id: 'update',
style: 'squared',
title: Ox._('Software Update...')
})
.bindEvent({
click: function() {
oml.UI.set({page: 'update'});
}
}),
{},
Ox.Button({ Ox.Button({
id: 'close', id: 'close',
style: 'squared',
title: Ox._('Close') title: Ox._('Close')
}).bindEvent({ }).bindEvent({
click: function() { click: function() {

View File

@ -36,7 +36,7 @@ oml.ui.appPanel = function() {
} }
// open dialog // open dialog
if (Ox.contains([ if (Ox.contains([
'welcome', 'app', 'preferences', 'users', 'welcome', 'app', 'update', 'preferences', 'users',
'notifications', 'transfers', 'help' 'notifications', 'transfers', 'help'
], page)) { ], page)) {
oml.$ui[page + 'Dialog'] = oml.ui[page + 'Dialog']().open(); oml.$ui[page + 'Dialog'] = oml.ui[page + 'Dialog']().open();

View File

@ -19,11 +19,16 @@ oml.ui.mainMenu = function() {
id: 'appMenu', id: 'appMenu',
title: '<img src="/static/png/oml.png" style="width: 14px; height: 14px">', title: '<img src="/static/png/oml.png" style="width: 14px; height: 14px">',
items: [ items: [
appItems.slice(0, 2), appItems.slice(0, 1),
{} {}
].concat( ].concat(
appItems.slice(2) appItems.slice(1)
).concat([ ).concat([
{},
{
id: 'update',
title: 'Software Update...'
},
{}, {},
{ {
id: 'quit', id: 'quit',
@ -341,11 +346,14 @@ oml.ui.mainMenu = function() {
click: function(data) { click: function(data) {
var id = data.id; var id = data.id;
if (Ox.contains([ if (Ox.contains([
'about', 'faq', 'terms', 'about', 'faq', 'terms', 'development', 'contact'
'development', 'contact', 'update'
], id)) { ], id)) {
oml.UI.set({'part.app': id}); oml.UI.set({'part.app': id});
oml.UI.set({page: 'app'}); oml.UI.set({page: 'app'});
} else if (id == 'update') {
oml.$ui.updateDialog = oml.ui.updateDialog().open();
} else if (id == 'quit') {
oml.api.quit();
} else if (id == 'preferences') { } else if (id == 'preferences') {
oml.UI.set({page: 'preferences'}); oml.UI.set({page: 'preferences'});
} else if (id == 'users') { } else if (id == 'users') {
@ -475,10 +483,6 @@ oml.ui.mainMenu = function() {
} else { } else {
Ox.print('no way to download multiple right now'); Ox.print('no way to download multiple right now');
} }
} else if (id == 'quit') {
oml.api.quit(function() {
// ...
});
} else { } else {
Ox.print('MAIN MENU DOES NOT YET HANDLE', id); Ox.print('MAIN MENU DOES NOT YET HANDLE', id);
} }

View File

@ -33,8 +33,8 @@ oml.ui.updateDialog = function() {
[oml.version] [oml.version]
) )
: Ox._( : Ox._(
'<p>You are running the development version of ' 'You are running the development version of '
+ 'Open Media Library.</p>' + 'Open Media Library.<br><br>'
) )
) )
.appendTo($content), .appendTo($content),
@ -125,16 +125,16 @@ oml.ui.updateDialog = function() {
$text.append(Ox._( $text.append(Ox._(
'A newer version ({0}) is available.', 'A newer version ({0}) is available.',
[result.data.version] [result.data.version]
)) ));
$closeButton.hide();
$dontUpdateButton.show();
$updateButton.show();
} }
}); });
} else { } else {
$text.append(Ox._( $text.append(Ox._(
'To update, run <span class="OxMonospace">./ctl update</span>.' 'To update, run <span class="OxMonospace">./ctl update</span>.'
)); ));
$closeButton.hide();
$dontUpdateButton.show();
$updateButton.show();
} }
function reload() { function reload() {

View File

@ -63,6 +63,7 @@
"toolbar.js", "toolbar.js",
"transfersDialog.js", "transfersDialog.js",
"updateButton.js", "updateButton.js",
"updateDialog.js",
"userButton.js", "userButton.js",
"usersDialog.js", "usersDialog.js",
"utils.js", "utils.js",