1
0
Fork 0

Phi: first incomplete aircraft selection/install

requires latest flightgear source patch introducing /pkg/ uri handler
This commit is contained in:
Torsten Dreyer 2015-02-17 12:11:35 +01:00
parent d37966b0d1
commit 32d99af20a
3 changed files with 72 additions and 7 deletions

View file

@ -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();

View file

@ -1,2 +1,44 @@
<h1>Select another Aircraft</h1>
TBD.
<div data-bind="foreach: catalogs">
<h3>Package <span data-bind="text: id"></span></h3>
<!--
<div>
Source <span data-bind="text: url"></span>
</div>
<div>
Installed at <span data-bind="text: installRoot"></span>
</div>
-->
<table class="phi-aircraft-package-table ui-widget-content ui-corner-all">
<caption class="ui-widget-header ui-corner-all" data-bind="text: description"></caption>
<thead>
<tr>
<th>Aircraft</th>
<th>Description</th>
<th>FDM</th>
<th>Systems</th>
<th>Cockpit</th>
<th>Model</th>
<th>kB</th>
<th></th>
</tr>
</thead>
<tbody data-bind="foreach: packages">
<tr>
<td colspan="5"><span data-bind="text: name"></span></td>
</tr>
<tr>
<td><img data-bind="attr: { src: thumbnails[0], alt: name, title: name }" width="171"></img></td>
<td><span data-bind="text: description"></span></td>
<td><span data-bind="text: ratingFdm"></span></td>
<td><span data-bind="text: ratingSystems"></span></td>
<td><span data-bind="text: ratingCockpit"></span></td>
<td><span data-bind="text: ratingModel"></span></td>
<td><span data-bind="text: (fileSize/1024).toFixed(0)"></span></td>
<td data-bind="if: installed">installed</td>
<td data-bind="ifnot: installed">
<button data-bind=" click: $parents[1].install">Install</button>
</td>
</tr>
</tbody>
</table>
</div>

View file

@ -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 {