Fixed a name bug that's been around for a while.

Fixed a bug with names that has been around with a while. An empty first
name no longer crashes the dweller editor.
This commit is contained in:
TheCreatorJames committed 2016-07-22 18:38:15 -05:00
1 parent ed244e6f76
commit ef484e9f34
2 files changed
+15 -12

No files matched your search

+1 -1
View File
@@ -166,7 +166,7 @@
<div class="form-group row">
<div class="col-sm-4">
<label>First Name</label>
<input type="text" class="form-control" name="firstName" placeholder="First Name" ng-model="dweller.name">
<input type="text" class="form-control" name="firstName" placeholder="First Name" ng-model="firstName">
</div>
<div class="col-sm-4">
+14 -11
View File
@@ -174,8 +174,6 @@ $('body .container .box')
// Modifications
function edit(fileName, save) {
isLoaded=true;
var scope = angular.element($('body').get(0)).scope();
@@ -183,8 +181,6 @@ function edit(fileName, save) {
scope.save = save;
scope.fileName = fileName;
});
}
var app = angular.module('shelter', []);
@@ -203,8 +199,20 @@ app.controller('dwellerController', function ($scope) {
_petCarrierCount = 0,
_starterPackCount = 0,
_skinColor = null,
_hairColor = null;
_hairColor = null,
_firstName = null;
Object.defineProperty($scope, 'firstName', {
get: function () {
return _firstName
},
set: function (val) {
if(val.trim().length == 0) val = "Vault Dweller";
_firstName = val;
$scope.dweller.name = val;
}
});
Object.defineProperty($scope, 'skinColor', {
get: function () {
@@ -216,7 +224,6 @@ app.controller('dwellerController', function ($scope) {
}
});
Object.defineProperty($scope, 'hairColor', {
get: function () {
return _hairColor
@@ -238,11 +245,6 @@ app.controller('dwellerController', function ($scope) {
}
});
Object.defineProperty($scope, 'lunchboxCount', {
get: function () {
return _lunchboxCount
@@ -291,6 +293,7 @@ app.controller('dwellerController', function ($scope) {
$scope.editDweller = function (dweller) {
$scope.dweller = dweller;
_firstName = $scope.dweller.name;
_skinColor = colorConverter($scope.dweller.skinColor, true);
_hairColor = colorConverter($scope.dweller.hairColor, true);
setTimeout(colorHack, 200);