mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Adding comparison charts, fixes and tweaks
This commit is contained in:
@@ -13,8 +13,11 @@ angular.module('app').service('Persist', ['lodash', function (_) {
|
||||
this.builds = {};
|
||||
}
|
||||
|
||||
var buildCount = Object.keys(this.builds).length;
|
||||
|
||||
this.state = {
|
||||
hasBuilds: Object.keys(this.builds).length > 0
|
||||
buildCount: buildCount,
|
||||
hasBuilds: buildCount > 0
|
||||
}
|
||||
/**
|
||||
* Persist a ship build in local storage.
|
||||
@@ -28,8 +31,12 @@ angular.module('app').service('Persist', ['lodash', function (_) {
|
||||
this.builds[shipId] = {};
|
||||
}
|
||||
|
||||
if(!this.builds[shipId][name]) {
|
||||
this.state.buildCount++;
|
||||
this.state.hasBuilds = true;
|
||||
}
|
||||
|
||||
this.builds[shipId][name] = code;
|
||||
this.state.hasBuilds = true;
|
||||
// Persist updated build collection to localStorage
|
||||
localStorage.setItem(LS_KEY_BUILDS, angular.toJson(this.builds));
|
||||
}
|
||||
@@ -61,7 +68,8 @@ angular.module('app').service('Persist', ['lodash', function (_) {
|
||||
delete this.builds[shipId][name];
|
||||
if (Object.keys(this.builds[shipId]).length == 0) {
|
||||
delete this.builds[shipId];
|
||||
this.state.hasBuilds = Object.keys(this.builds).length > 0;
|
||||
this.state.buildCount--;
|
||||
this.state.hasBuilds = this.state.buildCount > 0;
|
||||
}
|
||||
// Persist updated build collection to localStorage
|
||||
localStorage.setItem(LS_KEY_BUILDS, angular.toJson(this.builds));
|
||||
|
||||
Reference in New Issue
Block a user