mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 22:55:35 +00:00
Adding beginnings of comparison feature
This commit is contained in:
@@ -26,6 +26,7 @@ angular.module('app').config(['$provide','$stateProvider', '$urlRouterProvider',
|
||||
}
|
||||
})
|
||||
.state('shipyard', { url: '/', templateUrl: 'views/page-shipyard.html', controller: 'ShipyardController' })
|
||||
.state('comparison', { url: '/comparison', templateUrl: 'views/page-comparison.html', controller: 'ComparisonController' })
|
||||
.state('error', { params: {type:null, message:null, details: null }, templateUrl: 'views/page-error.html', controller: 'ErrorController' })
|
||||
|
||||
// Redirects
|
||||
|
||||
24
app/js/controllers/controller-comparison.js
Normal file
24
app/js/controllers/controller-comparison.js
Normal 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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}]);
|
||||
@@ -29,6 +29,7 @@ angular.module('app').directive('shipyardHeader', ['lodash','$rootScope', 'Persi
|
||||
|
||||
$rootScope.$on('close', function () {
|
||||
scope.openedMenu = null;
|
||||
$rootScope.showAbout = false;
|
||||
});
|
||||
|
||||
scope.updateInsurance = function(){
|
||||
@@ -49,6 +50,17 @@ angular.module('app').directive('shipyardHeader', ['lodash','$rootScope', 'Persi
|
||||
scope.openedMenu = menu;
|
||||
};
|
||||
|
||||
scope.about = function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
scope.openedMenu = null;
|
||||
$rootScope.showAbout = true;
|
||||
};
|
||||
|
||||
$rootScope.hideAbout = function (){
|
||||
$rootScope.showAbout = false;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}]);
|
||||
@@ -56,7 +56,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
if (comps.internal[i] !== 0) {
|
||||
internal[i].id = comps.internal[i];
|
||||
internal[i].c = Components.internal(comps.internal[i]);
|
||||
if (internal[i].c.group == 'sg') {
|
||||
if (internal[i].c.grp == 'sg') {
|
||||
this.sgSI = i;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user