Merge pull request #379 from yemel/fix/ui-wallets-list

sort wallet list and fix display for unnamed wallets
This commit is contained in:
Manuel Aráoz 2014-05-15 15:39:36 -03:00
commit e8365f3cd5
2 changed files with 8 additions and 2 deletions

View file

@ -2,8 +2,13 @@
angular.module('copay.signin').controller('SigninController',
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
var cmp = function(o1, o2){
var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase();
return v1 > v2 ? 1 : ( v1 < v2 ) ? -1 : 0;
};
$scope.loading = false;
$scope.wallets = walletFactory.getWallets();
$scope.wallets = walletFactory.getWallets().sort(cmp);
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
$scope.openPassword = '';

View file

@ -73,7 +73,8 @@ Storage.prototype._write = function(k,v) {
// get value by key
Storage.prototype.getGlobal = function(k) {
return localStorage.getItem(k);
var item = localStorage.getItem(k);
return item == 'undefined' ? undefined : item;
};
// set value for key