Merge pull request #449 from gabrielbazan7/fix/addressbook

fix gravatar
This commit is contained in:
Gustavo Maximiliano Cortez 2016-10-13 17:55:29 -03:00 committed by GitHub
commit fe6998b162
3 changed files with 7 additions and 30 deletions

View file

@ -2,33 +2,10 @@
angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory) {
$scope.$on("$ionicView.beforeEnter", function(event, data){
var address = data.stateParams.address;
if (!address) {
$ionicHistory.back();
return;
}
addressbookService.get(address, function(err, obj) {
if (err) {
popupService.showAlert(err);
return;
}
if (!lodash.isObject(obj)) {
var name = obj;
obj = {
'name': name,
'address': address,
'email': ''
};
}
$scope.addressbookEntry = obj;
$timeout(function() {
$scope.$apply();
});
});
});
$scope.addressbookEntry = {};
$scope.addressbookEntry.name = $stateParams.name;
$scope.addressbookEntry.email = $stateParams.email;
$scope.addressbookEntry.address = $stateParams.address;
$scope.sendTo = function() {
$ionicHistory.removeBackView();

View file

@ -571,7 +571,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('tabs.addressbook.view', {
url: '/view/:address',
url: '/view/:address/:email/:name',
views: {
'tab-settings@tabs': {
templateUrl: 'views/addressbook.view.html',

View file

@ -24,7 +24,7 @@
</div>
</ion-content>
<ion-content class="ng-hide" ng-show="!isEmptyList">
<div class="bar bar-header item-input-inset" ng-show="!isEmptyList">
<div class="bar bar-header item-input-inset" ng-show="!isEmptyList && addressbook.length >= 5">
<label class="item-input-wrapper">
<i class="icon ion-ios-search placeholder-icon"></i>
<input type="search"
@ -36,7 +36,7 @@
<ion-list>
<ion-item ng-repeat="addrEntry in addressbook"
class="item-icon-right item-avatar"
ui-sref="tabs.addressbook.view({address:addrEntry.address})">
ui-sref="tabs.addressbook.view({address:addrEntry.address, email: addrEntry.email, name: addrEntry.name})">
<gravatar name="{{addrEntry.name}}" width="50" email="{{addrEntry.email}}"></gravatar>
<h2>{{addrEntry.name}}</h2>
<p>{{addrEntry.address}}</p>