Merge pull request #437 from colkito/fix/address-list-selected-item

Fix/address list selected item
This commit is contained in:
Gustavo Maximiliano Cortez 2014-05-20 14:40:58 -03:00
commit 8de18364ba
3 changed files with 11 additions and 11 deletions

View File

@ -110,7 +110,7 @@ body {
background: #fff;
}
.addresses .panel:hover {
.addresses .panel:hover, .addresses .panel.selected {
background: #efefef;
}

View File

@ -314,13 +314,12 @@
<!-- ADDRESS -->
<script type="text/ng-template" id="addresses.html">
<div class="addresses" data-ng-controller="AddressesController">
<div class="addresses" ng-controller="AddressesController">
<div ng-show='$root.wallet.publicKeyRing.isComplete()'>
<div class="row">
<div class="large-9 medium-12 columns" ng-if="addrInfos[0]">
<div class="large-8 medium-8 columns">
<a class="panel radius db" ng-repeat="addrInfo in addrInfos"
ng-click="selectAddr(addrInfo.address.toString())">
<a class="panel radius db" ng-repeat="addrInfo in addrInfos" ng-click="$root.selectedAddr = addrInfo.address.toString()" ng-class="selectAddr('{{addrInfo.address.toString()}}')">
<span>{{addrInfo.address.toString()}}</span>
<span ng-if="addrInfo.isChange">(change)</span>
<span class="right">

View File

@ -1,23 +1,24 @@
'use strict';
angular.module('copay.addresses').controller('AddressesController',
function($scope, $rootScope, controllerUtils) {
function($scope, $rootScope, $timeout, controllerUtils) {
$scope.loading = false;
var w = $rootScope.wallet;
$scope.newAddr = function() {
$scope.loading=true;
$scope.loading = true;
w.generateAddress(null, function() {
setTimeout(function() {
$timeout(function() {
controllerUtils.setSocketHandlers();
controllerUtils.updateAddressList();
$scope.loading=false;
$rootScope.selectedAddr = $rootScope.addrInfos[0].address.toString();
$scope.loading = false;
$rootScope.$digest();
},1);
});
};
$scope.selectAddr = function(addr) {
$scope.selectedAddr = addr;
$scope.selectAddr = function (addr) {
return addr === $rootScope.selectedAddr ? 'selected' : '';
};
});