From 32d99af20a7cb0c2c9fb56dad577294e002f7025 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Tue, 17 Feb 2015 12:11:35 +0100 Subject: [PATCH] Phi: first incomplete aircraft selection/install requires latest flightgear source patch introducing /pkg/ uri handler --- webgui/topics/Aircraft.js | 2 +- webgui/topics/Aircraft/Select.html | 46 ++++++++++++++++++++++++++++-- webgui/topics/Aircraft/Select.js | 31 +++++++++++++++++--- 3 files changed, 72 insertions(+), 7 deletions(-) diff --git a/webgui/topics/Aircraft.js b/webgui/topics/Aircraft.js index 9aa4ff1ea..8d1451b44 100644 --- a/webgui/topics/Aircraft.js +++ b/webgui/topics/Aircraft.js @@ -21,7 +21,7 @@ define([ var self = this; self.topics = [ - /*'Select', */'Mass & Balance', 'Checklists', 'Failures', 'Panel', 'Help' + 'Select', 'Mass & Balance', 'Checklists', 'Failures', 'Panel', 'Help' ]; self.selectedTopic = ko.observable(); diff --git a/webgui/topics/Aircraft/Select.html b/webgui/topics/Aircraft/Select.html index 68dd1ae01..a36a74f10 100644 --- a/webgui/topics/Aircraft/Select.html +++ b/webgui/topics/Aircraft/Select.html @@ -1,2 +1,44 @@ -

Select another Aircraft

-TBD. \ No newline at end of file +
+

Package

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AircraftDescriptionFDMSystemsCockpitModelkB
installed + +
+
\ No newline at end of file diff --git a/webgui/topics/Aircraft/Select.js b/webgui/topics/Aircraft/Select.js index a2f128341..e0b19a2c6 100644 --- a/webgui/topics/Aircraft/Select.js +++ b/webgui/topics/Aircraft/Select.js @@ -1,12 +1,35 @@ define([ - 'knockout', 'text!./Select.html' -], function(ko, htmlString) { + 'jquery', 'knockout', 'text!./Select.html', 'fgcommand', 'kojqui/button' +], function(jquery, ko, htmlString,fgcommand) { + function ViewModel(params) { var self = this; + + self.catalogs = ko.observableArray([]); + + self.install = function(pack) { + console.log("install", pack); +// jquery.get('/pkg/install/'+pack.id); + fgcommand.switchAircraft(pack.id); + } + + self.uninstall = function(pack) { + console.log("uninstall", pack); + } + + self.select = function(pack) { + console.log("select", pack ); + } + + jquery.get('/pkg/catalogs', null, function(data) { + if( data.catalogs ) + self.catalogs(data.catalogs); + + }); } - ViewModel.prototype.dispose = function() { - } +// ViewModel.prototype.dispose = function() { +// } // Return component definition return {