From 5f37f27b9d034f1f29b1fe761eebc2a7902a280c Mon Sep 17 00:00:00 2001 From: rlx Date: Wed, 13 Jan 2016 09:46:48 +0530 Subject: [PATCH] update main menu, app dialog, update dialog --- config.json | 2 +- static/js/appDialog.js | 14 +++++++++++++- static/js/appPanel.js | 2 +- static/js/mainMenu.js | 20 ++++++++++++-------- static/js/updateDialog.js | 12 ++++++------ static/json/js.json | 1 + 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/config.json b/config.json index 3d697b4..f2ad3b3 100644 --- a/config.json +++ b/config.json @@ -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"}, diff --git a/static/js/appDialog.js b/static/js/appDialog.js index c679591..ebb311f 100644 --- a/static/js/appDialog.js +++ b/static/js/appDialog.js @@ -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() { diff --git a/static/js/appPanel.js b/static/js/appPanel.js index 8beef62..71a45e3 100644 --- a/static/js/appPanel.js +++ b/static/js/appPanel.js @@ -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(); diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index 249b674..bf556fe 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -19,11 +19,16 @@ oml.ui.mainMenu = function() { id: 'appMenu', title: '', 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); } diff --git a/static/js/updateDialog.js b/static/js/updateDialog.js index c998b5e..962d0b9 100644 --- a/static/js/updateDialog.js +++ b/static/js/updateDialog.js @@ -33,8 +33,8 @@ oml.ui.updateDialog = function() { [oml.version] ) : Ox._( - '

You are running the development version of ' - + 'Open Media Library.

' + 'You are running the development version of ' + + 'Open Media Library.

' ) ) .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 ./ctl update.' )); - $closeButton.hide(); - $dontUpdateButton.show(); - $updateButton.show(); } function reload() { diff --git a/static/json/js.json b/static/json/js.json index d961e65..0c15822 100644 --- a/static/json/js.json +++ b/static/json/js.json @@ -63,6 +63,7 @@ "toolbar.js", "transfersDialog.js", "updateButton.js", + "updateDialog.js", "userButton.js", "usersDialog.js", "utils.js",