diff --git a/css/src/main.css b/css/src/main.css index da58e742f..0bde63293 100644 --- a/css/src/main.css +++ b/css/src/main.css @@ -964,8 +964,9 @@ table tbody tr:last-child td { border-bottom: none; } -table tr.deleting { - background: #FCD5D5; +table.manage-wallets tr:hover { + background-color: #eee; + cursor: pointer; } input[type=date], input[type=datetime-local], input[type=datetime], input[type=email], input[type=month], input[type=number], input[type=password], input[type=search], input[type=tel], input[type=text], input[type=time], input[type=url], input[type=week], textarea { diff --git a/js/controllers/profile.js b/js/controllers/profile.js index ee9bfc576..ad21e9bf7 100644 --- a/js/controllers/profile.js +++ b/js/controllers/profile.js @@ -1,7 +1,7 @@ 'use strict'; -angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, $timeout, backupService, identityService) { +angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, $timeout, backupService, identityService, isMobile) { $scope.username = $rootScope.iden.getName(); - $scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + $scope.isSafari = isMobile.Safari(); $rootScope.title = 'Profile'; $scope.hideAdv = true; @@ -13,18 +13,7 @@ angular.module('copayApp.controllers').controller('ProfileController', function( $scope.viewProfileBackup = function() { $scope.backupProfilePlainText = backupService.profileEncrypted($rootScope.iden); $scope.hideViewProfileBackup = true; - }; - - $scope.deleteWallet = function(w) { - if (!w) return; - identityService.deleteWallet(w, function(err) { - $scope.loading = false; - if (err) { - copay.logger.warn(err); - } - $scope.setWallets(); - }); - }; + }; $scope.init = function() { @@ -52,30 +41,7 @@ angular.module('copayApp.controllers').controller('ProfileController', function( $timeout(function(){ $scope.$digest(); }) - }; - - $scope.downloadWalletBackup = function(w) { - if (!w) return; - backupService.walletDownload(w); - } - - $scope.viewWalletBackup = function(w) { - var ModalInstanceCtrl = function($scope, $modalInstance) { - - if (!w) return; - $scope.backupWalletPlainText = backupService.walletEncrypted(w); - $scope.hideViewWalletBackup = true; - $scope.cancel = function() { - $modalInstance.dismiss('cancel'); - }; - }; - - $modal.open({ - templateUrl: 'views/modals/backup-text.html', - windowClass: 'tiny', - controller: ModalInstanceCtrl - }); - }; + }; $scope.deleteProfile = function() { identityService.deleteProfile(function(err, res) { @@ -90,4 +56,45 @@ angular.module('copayApp.controllers').controller('ProfileController', function( }, 1); }); }; + + $scope.walletInfo = function(w) { + var ModalInstanceCtrl = function($scope, $modalInstance) { + if (!w) return; + $scope.isSafari = isMobile.Safari(); + $scope.item = w; + + $scope.deleteWallet = function() { + $scope.loading = true; + identityService.deleteWallet($scope.item, function(err) { + if (err) { + copay.logger.warn(err); + } + $modalInstance.close(); + }); + }; + + $scope.downloadWalletBackup = function() { + backupService.walletDownload($scope.item); + }; + + $scope.viewWalletBackup = function() { + $scope.backupWalletPlainText = backupService.walletEncrypted($scope.item); + }; + + $scope.close = function() { + $modalInstance.dismiss('cancel'); + }; + }; + + var modalInstance = $modal.open({ + templateUrl: 'views/modals/wallet-info.html', + windowClass: 'tiny', + controller: ModalInstanceCtrl + }); + + modalInstance.result.then(function() { + $scope.loading = false; + $scope.setWallets(); + }); + }; }); diff --git a/js/services/isMobile.js b/js/services/isMobile.js index 1a859064d..ad0ffb81a 100644 --- a/js/services/isMobile.js +++ b/js/services/isMobile.js @@ -17,6 +17,9 @@ var isMobile = { Windows: function() { return !!navigator.userAgent.match(/IEMobile/i); }, + Safari: function() { + return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } diff --git a/views/modals/backup-text.html b/views/modals/backup-text.html deleted file mode 100644 index ff9e83d9d..000000000 --- a/views/modals/backup-text.html +++ /dev/null @@ -1,10 +0,0 @@ -
-

Copy backup in a safe place

- - -
- Copy this text as it is in a safe place (notepad or email) -
-
- -× diff --git a/views/modals/wallet-info.html b/views/modals/wallet-info.html new file mode 100644 index 000000000..fbb68d748 --- /dev/null +++ b/views/modals/wallet-info.html @@ -0,0 +1,49 @@ +
+

{{item.name || item.id }}

+

+ {{item.requiredCopayers}} of {{item.totalCopayers}} - {{networkName}} + , {{isComplete ? 'Complete' : 'Waiting for copayers...'}} +

+
+ {{item.balanceInfo.totalBalance || 0}} {{item.settings.unitName}} +
+
+ Approximate size: {{item.kb}} kB + ({{item.usage}}%) +
+ +
+
+ + +
+
+ +
+
+ +
+

Copy backup in a safe place

+
+ + + +
+
+ Copy this text as it is in a safe place (notepad or email) +
+
+ + × +
diff --git a/views/profile.html b/views/profile.html index 4ea689d2d..41a7a0d78 100644 --- a/views/profile.html +++ b/views/profile.html @@ -43,54 +43,43 @@

Manage wallets

- +
- - - + + - + ng-init="isComplete = item.isComplete(); networkName = item.getNetworkName()" + ng-click="walletInfo(item)"> + - - - -
Name Type StatusBalanceApprox SizeActionsBalanceApprox Size
{{item.name || item.id }} + + + {{item.name || item.id }} + + {{item.requiredCopayers}} of {{item.totalCopayers}} - {{networkName}} {{isComplete ? 'Complete' : 'Waiting for copayers...'}} + - {{item.balanceInfo.totalBalance || 0}} {{item.settings.unitName}} + {{item.kb}} kB ({{item.usage}}%) -
- - -   - -
- -