From cd8158de05072373e1fb9a9046e592379f8f5cd9 Mon Sep 17 00:00:00 2001 From: rlx Date: Mon, 18 Jan 2016 11:46:50 +0530 Subject: [PATCH] add dummy help dialog --- static/js/appPanel.js | 3 +- static/js/helpDialog.js | 72 +++++++++++++++++++++++++++++++++++++++++ static/js/mainMenu.js | 18 +++++++---- static/json/js.json | 1 + 4 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 static/js/helpDialog.js diff --git a/static/js/appPanel.js b/static/js/appPanel.js index 2742708..40fee21 100644 --- a/static/js/appPanel.js +++ b/static/js/appPanel.js @@ -30,7 +30,8 @@ oml.ui.appPanel = function() { appDialog: ['about', 'faq', 'terms', 'development', 'contact'], updateDialog: ['update'], userDialog: ['preferences', 'peers', 'transfers'], - importExportDialog: ['import', 'export'] + importExportDialog: ['import', 'export'], + helpDialog: ['help', 'documentation'] }; // close dialogs if (Ox.every(dialogs, function(pages) { diff --git a/static/js/helpDialog.js b/static/js/helpDialog.js new file mode 100644 index 0000000..6e2a172 --- /dev/null +++ b/static/js/helpDialog.js @@ -0,0 +1,72 @@ +'use strict'; + +oml.ui.helpDialog = function() { + + var ui = oml.user.ui, + + $panel = Ox.TabPanel({ + content: function(id) { + return Ox.Element() + .addClass('OxTextPage OxSelectable') + .css({margin: '16px'}) + .html( + '

The lazy brown fox and the lazy black fox ' + + 'were observed singing "Loret ipsum", ' + + 'but other than that not really much happened here ' + + 'since you last checked.

' + ); + }, + style: 'squared', + tabs: [ + { + id: 'help', + title: Ox._('Help'), + selected: ui.page == 'help' + }, + { + id: 'documentation', + title: Ox._('API Documentation'), + selected: ui.page == 'documentation' + } + ] + }) + .bindEvent({ + change: function(data) { + oml.UI.set({page: data.selected}); + } + }), + + that = Ox.Dialog({ + buttons: [ + Ox.Button({ + id: 'close', + style: 'squared', + title: Ox._('Close') + }).bindEvent({ + click: function() { + that.close(); + } + }) + ], + closeButton: true, + content: $panel, + height: 384, + keys: {escape: 'close'}, + maximizeButton: true, + minHeight: 256, + minWidth: 544 + 2 * Ox.UI.SCROLLBAR_SIZE, + removeOnClose: true, + title: 'Open Media Libary', + width: 672 + 2 * Ox.UI.SCROLLBAR_SIZE + }) + .bindEvent({ + close: function() { + if (Ox.contains(['help', 'documentation'], ui.page)) { + oml.UI.set({page: ''}); + } + } + }); + + return that; + +}; \ No newline at end of file diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index 96630ec..b437318 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -311,18 +311,15 @@ oml.ui.mainMenu = function() { id: 'helpMenu', title: Ox._('Help'), items: [ - { - id: 'gettingstarted', - title: 'Getting Started...' - }, { id: 'help', - title: Ox._('{0} Help...', ['Open Media Library']), + title: Ox._('Help...'), keyboard: 'control ?' }, + {}, { id: 'documentation', - title: Ox._('Documentation...'), + title: Ox._('API Documentation...'), keyboard: 'shift control ?' } ] @@ -562,6 +559,10 @@ oml.ui.mainMenu = function() { )).open(); } else if (id == 'advancedfind') { oml.$ui.findDialog = oml.ui.findDialog().open(); + } else if (id == 'help') { + oml.UI.set({page: 'help'}); + } else if (id == 'documentation') { + oml.UI.set({page: 'documentation'}); } else { Ox.print('MAIN MENU DOES NOT YET HANDLE', id); } @@ -666,6 +667,11 @@ oml.ui.mainMenu = function() { oml.$ui.findDialog = oml.ui.findDialog().open(); } }, + key_control_slash: function() { + if (!oml.hasDialogOrScreen()) { + oml.UI.set({page: 'documentation'}); + } + }, key_control_shift_w: function() { if (!oml.hasDialogOrScreen()) { oml.UI.set({ diff --git a/static/json/js.json b/static/json/js.json index 9b19d05..3a77998 100644 --- a/static/json/js.json +++ b/static/json/js.json @@ -27,6 +27,7 @@ "folders.js", "fullscreenButton.js", "gridView.js", + "helpDialog.js", "iconDialog.js", "identifyDialog.js", "importExportDialog.js",