mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
Major refactor for language support, EN, DE, ES, FR, RU
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
angular.module('app').controller('ComparisonController', ['lodash', '$rootScope', '$filter', '$scope', '$state', '$stateParams', 'Utils', 'ShipFacets', 'ShipsDB', 'Ship', 'Persist', 'Serializer', function(_, $rootScope, $filter, $scope, $state, $stateParams, Utils, ShipFacets, Ships, Ship, Persist, Serializer) {
|
||||
angular.module('app').controller('ComparisonController', ['lodash', '$rootScope', '$filter', '$scope', '$state', '$stateParams', '$translate', 'Utils', 'ShipFacets', 'ShipsDB', 'Ship', 'Persist', 'Serializer', function(_, $rootScope, $filter, $scope, $state, $stateParams, $translate, Utils, ShipFacets, Ships, Ship, Persist, Serializer) {
|
||||
$rootScope.title = 'Coriolis - Compare';
|
||||
$scope.predicate = 'name'; // Sort by ship name as default
|
||||
$scope.desc = false;
|
||||
@@ -155,7 +155,7 @@ angular.module('app').controller('ComparisonController', ['lodash', '$rootScope'
|
||||
return 'Error - ' + err.statusText;
|
||||
}
|
||||
);
|
||||
$state.go('modal.export', { promise: promise, title: 'Forum BBCode' });
|
||||
$state.go('modal.export', { promise: promise, title: $translate.instant('FORUM') + ' BBCode' });
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -184,6 +184,10 @@ angular.module('app').controller('ComparisonController', ['lodash', '$rootScope'
|
||||
$scope.showBuilds = false;
|
||||
});
|
||||
|
||||
$scope.$on('languageChanged', function() {
|
||||
$scope.tblUpdate = !$scope.tblUpdate; // Simple switch to trigger the table to update
|
||||
});
|
||||
|
||||
/* Initialization */
|
||||
if ($scope.compareMode) {
|
||||
if ($scope.name == 'all') {
|
||||
@@ -226,7 +230,7 @@ angular.module('app').controller('ComparisonController', ['lodash', '$rootScope'
|
||||
}
|
||||
}
|
||||
// Replace fmt with actual format function as defined in rootScope and retain original index
|
||||
facets.forEach(function(f, i) { f.fmt = $rootScope[f.fmt]; f.index = i; });
|
||||
facets.forEach(function(f, i) { f.index = i; });
|
||||
// Remove default facets, mark as active, and add them back in selected order
|
||||
_.pullAt(facets, defaultFacets).forEach(function(f) { f.active = true; facets.unshift(f); });
|
||||
$scope.builds = $filter('orderBy')($scope.builds, $scope.predicate, $scope.desc);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('app').controller('OutfitController', ['$window', '$rootScope', '$scope', '$state', '$stateParams', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', 'calcTotalRange', 'calcSpeed', function($window, $rootScope, $scope, $state, $p, Ships, Ship, Components, Serializer, Persist, calcTotalRange, calcSpeed) {
|
||||
angular.module('app').controller('OutfitController', ['$window', '$rootScope', '$scope', '$state', '$stateParams', '$translate', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', 'calcTotalRange', 'calcSpeed', function($window, $rootScope, $scope, $state, $p, $translate, Ships, Ship, Components, Serializer, Persist, calcTotalRange, calcSpeed) {
|
||||
var win = angular.element($window); // Angularized window object for event triggering
|
||||
var data = Ships[$p.shipId]; // Retrieve the basic ship properties, slots and defaults
|
||||
var ship = new Ship($p.shipId, data.properties, data.slots); // Create a new Ship instance
|
||||
@@ -65,11 +65,11 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
$scope.jrChart = {
|
||||
labels: {
|
||||
xAxis: {
|
||||
title: 'Cargo',
|
||||
title: 'cargo',
|
||||
unit: 'T'
|
||||
},
|
||||
yAxis: {
|
||||
title: 'Jump Range',
|
||||
title: 'jump range',
|
||||
unit: 'LY'
|
||||
}
|
||||
}
|
||||
@@ -87,11 +87,11 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
$scope.trChart = {
|
||||
labels: {
|
||||
xAxis: {
|
||||
title: 'Cargo',
|
||||
title: 'cargo',
|
||||
unit: 'T'
|
||||
},
|
||||
yAxis: {
|
||||
title: 'Total Range',
|
||||
title: 'total range',
|
||||
unit: 'LY'
|
||||
}
|
||||
}
|
||||
@@ -110,11 +110,11 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
$scope.speedChart = {
|
||||
labels: {
|
||||
xAxis: {
|
||||
title: 'Cargo',
|
||||
title: 'cargo',
|
||||
unit: 'T'
|
||||
},
|
||||
yAxis: {
|
||||
title: 'Speed',
|
||||
title: 'speed',
|
||||
unit: 'm/s'
|
||||
}
|
||||
}
|
||||
@@ -258,8 +258,8 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
|
||||
if ($scope.buildName) {
|
||||
$state.go('modal.export', {
|
||||
title: $scope.buildName + ' Export',
|
||||
description: 'A detailed JSON export of your build for use in other sites and tools',
|
||||
title: $scope.buildName + ' ' + $translate.instant('export'),
|
||||
description: $translate.instant('PHRASE_EXPORT_DESC'),
|
||||
data: Serializer.toDetailedBuild($scope.buildName, ship, $scope.code || Serializer.fromShip(ship))
|
||||
});
|
||||
}
|
||||
@@ -366,15 +366,14 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
|
||||
function updateRetrofitCosts() {
|
||||
var costs = $scope.retrofitList = [];
|
||||
var cName = $rootScope.cName;
|
||||
var total = 0, i, l, item;
|
||||
|
||||
if (ship.bulkheads.id != retrofitShip.bulkheads.id) {
|
||||
item = {
|
||||
buyClassRating: ship.bulkheads.c.class + ship.bulkheads.c.rating,
|
||||
buyName: cName(ship.bulkheads),
|
||||
buyName: ship.bulkheads.c.name,
|
||||
sellClassRating: retrofitShip.bulkheads.c.class + retrofitShip.bulkheads.c.rating,
|
||||
sellName: cName(retrofitShip.bulkheads),
|
||||
sellName: retrofitShip.bulkheads.c.name,
|
||||
netCost: ship.bulkheads.discountedCost - retrofitShip.bulkheads.discountedCost
|
||||
};
|
||||
costs.push(item);
|
||||
@@ -388,12 +387,12 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
if (slotGroup[i].id != retroSlotGroup[i].id) {
|
||||
item = { netCost: 0 };
|
||||
if (slotGroup[i].id) {
|
||||
item.buyName = cName(slotGroup[i]);
|
||||
item.buyName = slotGroup[i].c.name || slotGroup[i].c.grp;
|
||||
item.buyClassRating = slotGroup[i].c.class + slotGroup[i].c.rating;
|
||||
item.netCost = slotGroup[i].discountedCost;
|
||||
}
|
||||
if (retroSlotGroup[i].id) {
|
||||
item.sellName = cName(retroSlotGroup[i]);
|
||||
item.sellName = retroSlotGroup[i].c.name || retroSlotGroup[i].c.grp;
|
||||
item.sellClassRating = retroSlotGroup[i].c.class + retroSlotGroup[i].c.rating;
|
||||
item.netCost -= retroSlotGroup[i].discountedCost;
|
||||
}
|
||||
@@ -423,6 +422,11 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
$scope.selectedSlot = null;
|
||||
});
|
||||
|
||||
// Hide any open menu/slot/etc if the background is clicked
|
||||
$scope.$on('languageChanged', function() {
|
||||
$scope.selectedSlot = null;
|
||||
});
|
||||
|
||||
// Hide any open menu/slot/etc if the background is clicked
|
||||
$scope.$on('discountChange', function() {
|
||||
ship.applyDiscounts($rootScope.discounts.ship, $rootScope.discounts.components);
|
||||
|
||||
Reference in New Issue
Block a user