Adding beginnings of comparison feature

This commit is contained in:
Colin McLeod
2015-05-05 01:05:58 -07:00
parent 748e1261fe
commit f418e7a6ae
15 changed files with 224 additions and 12 deletions

View File

@@ -0,0 +1,24 @@
angular.module('app').controller('ComparisonController', ['$rootScope', '$scope', 'ShipsDB', 'Ship', 'Persist', 'Serializer', function ($rootScope, $scope, Ships, Ship, Persist, Serializer) {
$rootScope.title = 'Coriolis - Comparison';
$rootScope.bodyClass = 'docking-bay';
var comparison = $scope.comparison = [];
for (var shipId in Persist.builds) {
var data = Ships[shipId];
for (var buildName in Persist.builds[shipId]) {
var code = Persist.builds[shipId][buildName];
var ship = new Ship(shipId, data.properties, data.slots); // Create a new Ship instance
Serializer.toShip(ship, code); // Populate components from 'code' URL param
comparison.push({
shipId: shipId,
buildName: buildName,
ship: ship,
code: code
});
}
}
}]);