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; background: #fff;
} }
.addresses .panel:hover { .addresses .panel:hover, .addresses .panel.selected {
background: #efefef; background: #efefef;
} }

View file

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

View file

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