From 9173fdfab53ad02a5cded66ba4fc0ba0583dbae6 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Fri, 6 Feb 2015 11:36:53 +0100 Subject: [PATCH] Phi: Display the Aircraft Help Screen --- webgui/topics/Aircraft.js | 6 +++++- webgui/topics/Aircraft/Help.html | 6 ++++++ webgui/topics/Aircraft/Help.js | 33 ++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 webgui/topics/Aircraft/Help.html create mode 100644 webgui/topics/Aircraft/Help.js diff --git a/webgui/topics/Aircraft.js b/webgui/topics/Aircraft.js index 710965ed8..9aa4ff1ea 100644 --- a/webgui/topics/Aircraft.js +++ b/webgui/topics/Aircraft.js @@ -13,11 +13,15 @@ define([ require : 'topics/Aircraft/Checklists' }); + ko.components.register('Aircraft/Help', { + require : 'topics/Aircraft/Help' + }); + function ViewModel(params) { var self = this; self.topics = [ - /*'Select', */'Mass & Balance', 'Checklists', 'Failures', 'Panel' + /*'Select', */'Mass & Balance', 'Checklists', 'Failures', 'Panel', 'Help' ]; self.selectedTopic = ko.observable(); diff --git a/webgui/topics/Aircraft/Help.html b/webgui/topics/Aircraft/Help.html new file mode 100644 index 000000000..baf8e1fe5 --- /dev/null +++ b/webgui/topics/Aircraft/Help.html @@ -0,0 +1,6 @@ + +

+
+
+
diff --git a/webgui/topics/Aircraft/Help.js b/webgui/topics/Aircraft/Help.js new file mode 100644 index 000000000..777450a78 --- /dev/null +++ b/webgui/topics/Aircraft/Help.js @@ -0,0 +1,33 @@ +define([ + 'jquery', 'knockout', 'text!./Help.html' +], function(jquery, ko, htmlString) { + function ViewModel(params) { + var self = this; + + self.helpTitle = ko.observable(""); + self.helpText = ko.observableArray([]); + + jquery.get('/json/sim/help', null, function(data) { + + var helpText = []; + data.children.forEach(function(prop) { + if (prop.name === 'title') { + self.helpTitle(prop.value); + } else if (prop.name == 'line') { + helpText.push(prop.value); + } + }); + self.helpText(helpText); + + }); + } + +// ViewModel.prototype.dispose = function() { +// } + + // Return component definition + return { + viewModel : ViewModel, + template : htmlString + }; +});