Fix UX for address book view

This commit is contained in:
Gustavo Maximiliano Cortez 2017-05-30 12:58:41 -03:00
parent ece114389c
commit a8defa1377
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
3 changed files with 28 additions and 19 deletions

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory, platformInfo) { angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory, platformInfo, gettextCatalog) {
$scope.isChromeApp = platformInfo.isChromeApp; $scope.isChromeApp = platformInfo.isChromeApp;
$scope.addressbookEntry = {}; $scope.addressbookEntry = {};
$scope.addressbookEntry.name = $stateParams.name; $scope.addressbookEntry.name = $stateParams.name;
@ -20,13 +20,18 @@ angular.module('copayApp.controllers').controller('addressbookViewController', f
}; };
$scope.remove = function(addr) { $scope.remove = function(addr) {
addressbookService.remove(addr, function(err, ab) { var title = gettextCatalog.getString('Warning!');
if (err) { var message = gettextCatalog.getString('Are you sure you want to delete this contact?');
popupService.showAlert(gettextCatalog.getString('Error'), err); popupService.showConfirm(title, message, null, null, function(res) {
return; if (!res) return;
} addressbookService.remove(addr, function(err, ab) {
$ionicHistory.goBack(); if (err) {
}); popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$ionicHistory.goBack();
});
});
}; };
}); });

View File

@ -114,6 +114,9 @@
} }
#address-book-view { #address-book-view {
.has-click {
cursor: pointer;
}
.bar.bar-royal { .bar.bar-royal {
border: 0 transparent; border: 0 transparent;
} }

View File

@ -5,11 +5,6 @@
<ion-nav-title> <ion-nav-title>
<span>{{addressbookEntry.name}}</span> <span>{{addressbookEntry.name}}</span>
</ion-nav-title> </ion-nav-title>
<ion-nav-buttons side="secondary">
<button class="button back-button" ng-click="remove(addressbookEntry.address)">
Remove
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content scroll="false"> <ion-content scroll="false">
<div class="gravatar-content"> <div class="gravatar-content">
@ -27,13 +22,19 @@
<span class="address-book-field-label" translate>Email</span> <span class="address-book-field-label" translate>Email</span>
<span>{{addressbookEntry.email}}</span> <span>{{addressbookEntry.email}}</span>
</div> </div>
<div class="item item-text-wrap"> <div class="item item-text-wrap" copy-to-clipboard="addressbookEntry.address">
<span class="address-book-field-label" copy-to-clipboard="addressbookEntry.address" translate>Address</span> <span class="address-book-field-label" translate>Address</span>
<span>{{addressbookEntry.address}}</span> <span>{{addressbookEntry.address}}</span>
</div> </div>
</div> <div class="item item-divider"></div>
<button class="button button-standard button-primary" ng-click="sendTo()" translate> <div class="item item-icon-right has-click" ng-click="sendTo()">
Send Money <span class="positive" translate>Send Money</span>
</button> <i class="icon bp-arrow-right"></i>
</div>
<div class="item item-divider"></div>
<div class="item has-click" ng-click="remove(addressbookEntry.address)">
<span class="assertive" translate>Remove</span>
</div>
</div>
</ion-content> </ion-content>
</ion-view> </ion-view>