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": "app", "title": "Application", "parts": [
{"id": "about", "title": "About Open Media Library"},
{"id": "update", "title": "Software Update"},
{"id": "faq", "title": "Frequently Asked Questions"},
{"id": "terms", "title": "Terms and Conditions"},
{"id": "development", "title": "Software Development"},
{"id": "contact", "title": "Send Feedback"}
]},
{"id": "update", "title": "Software Update"},
{"id": "preferences", "title": "Preferences", "parts": [
{"id": "account", "title": "Account"},
{"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) {
return {
id: tab.id,
title: tab.title.replace(/ Open Media Library$/, ''),
title: tab.title,
selected: tab.id == ui.part.app
};
}),
@ -142,8 +142,20 @@ oml.ui.appDialog = function() {
that = Ox.Dialog({
buttons: [
Ox.Button({
id: 'update',
style: 'squared',
title: Ox._('Software Update...')
})
.bindEvent({
click: function() {
oml.UI.set({page: 'update'});
}
}),
{},
Ox.Button({
id: 'close',
style: 'squared',
title: Ox._('Close')
}).bindEvent({
click: function() {

View File

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

View File

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

View File

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

View File

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