Remove filter noFractionNumber from views. Fix conversionRate from send.

This commit is contained in:
Gustavo Maximiliano Cortez 2014-11-30 18:28:55 -03:00 committed by Matias Alejo Garcia
parent 7d822ac957
commit c215b3c15e
5 changed files with 23 additions and 17 deletions

View File

@ -2,7 +2,7 @@
var bitcore = require('bitcore'); var bitcore = require('bitcore');
angular.module('copayApp.controllers').controller('HistoryController', angular.module('copayApp.controllers').controller('HistoryController',
function($scope, $rootScope) { function($scope, $rootScope, $filter) {
var w = $rootScope.wallet; var w = $rootScope.wallet;
$rootScope.title = 'History'; $rootScope.title = 'History';
@ -138,6 +138,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
_.each(items, function(tx) { _.each(items, function(tx) {
tx.ts = tx.minedTs || tx.sentTs; tx.ts = tx.minedTs || tx.sentTs;
tx.rateTs = Math.floor((tx.ts || now) / 1000); tx.rateTs = Math.floor((tx.ts || now) / 1000);
tx.amount = $filter('noFractionNumber')(tx.amount);
}); });
var index = _.indexBy(items, 'rateTs'); var index = _.indexBy(items, 'rateTs');
@ -145,7 +146,8 @@ angular.module('copayApp.controllers').controller('HistoryController',
if (!err && res) { if (!err && res) {
_.each(res, function(r) { _.each(res, function(r) {
var tx = index[r.ts]; var tx = index[r.ts];
tx.alternativeAmount = r.rate != null ? tx.amountSat * rateService.SAT_TO_BTC * r.rate : null; tx.alternativeAmount = $filter('noFractionNumber')(
(r.rate != null ? tx.amountSat * rateService.SAT_TO_BTC * r.rate : null);
}); });
setTimeout(function() { setTimeout(function() {
$scope.$digest(); $scope.$digest();
@ -153,13 +155,10 @@ angular.module('copayApp.controllers').controller('HistoryController',
} }
}); });
$scope.blockchain_txs = w.cached_txs = items; $scope.blockchain_txs = w.cached_txs = items;
$scope.nbPages = res.nbPages; $scope.nbPages = res.nbPages;
$scope.totalItems = res.nbItems; $scope.totalItems = res.nbItems;
$scope.loading = false; $scope.loading = false;
setTimeout(function() { setTimeout(function() {
$scope.$digest(); $scope.$digest();

View File

@ -3,7 +3,7 @@ var bitcore = require('bitcore');
var preconditions = require('preconditions').singleton(); var preconditions = require('preconditions').singleton();
angular.module('copayApp.controllers').controller('SendController', angular.module('copayApp.controllers').controller('SendController',
function($scope, $rootScope, $window, $timeout, $modal, isMobile, notification, rateService) { function($scope, $rootScope, $window, $timeout, $modal, $filter, isMobile, notification, rateService) {
var w = $rootScope.wallet; var w = $rootScope.wallet;
preconditions.checkState(w); preconditions.checkState(w);
preconditions.checkState(w.settings.unitToSatoshi); preconditions.checkState(w.settings.unitToSatoshi);
@ -53,6 +53,11 @@ angular.module('copayApp.controllers').controller('SendController',
var domain = /^(?:https?)?:\/\/([^\/:]+).*$/.exec(url)[1]; var domain = /^(?:https?)?:\/\/([^\/:]+).*$/.exec(url)[1];
tx.merchant.domain = domain; tx.merchant.domain = domain;
} }
if (tx.outs) {
_.each(tx.outs, function(out) {
out.value = $filter('noFractionNumber')(out.value);
});
}
}); });
$scope.txps = res.txs; $scope.txps = res.txs;
}; };
@ -115,7 +120,9 @@ angular.module('copayApp.controllers').controller('SendController',
var pp = $rootScope.pendingPayment; var pp = $rootScope.pendingPayment;
$scope.address = pp.address + ''; $scope.address = pp.address + '';
var amount = pp.data.amount / w.settings.unitToSatoshi * 100000000; var amount = pp.data.amount / w.settings.unitToSatoshi * 100000000;
$scope.amount = amount; $scope.amount = $filter('noFractionNumber')(amount);
var alternativeAmount = rateService.toFiat((amount + defaultFee) * unitToSatoshi, alternativeIsoCode);
$scope.alternativeAmountPayPro = $filter('noFractionNumber')(alternativeAmount, 2);
$scope.commentText = pp.data.message; $scope.commentText = pp.data.message;
} }

View File

@ -45,8 +45,8 @@
'text-primary' : btx.action == 'received', 'text-primary' : btx.action == 'received',
'text-warning': btx.action == 'sent', 'text-warning': btx.action == 'sent',
'text-gray': btx.action == 'moved'}"> 'text-gray': btx.action == 'moved'}">
<b>{{btx.amount| noFractionNumber}} {{$root.wallet.settings.unitName}}</b> <b>{{btx.amount}} {{$root.wallet.settings.unitName}}</b>
<b ng-show="btx.alternativeAmount != null">{{btx.alternativeAmount| noFractionNumber}} {{$root.wallet.settings.alternativeIsoCode}}</b> <b ng-show="btx.alternativeAmount != null">{{btx.alternativeAmount}} {{$root.wallet.settings.alternativeIsoCode}}</b>
</div> </div>
</div> </div>

View File

@ -9,9 +9,9 @@
<div class="row" ng-repeat="out in tx.outs"> <div class="row" ng-repeat="out in tx.outs">
<div class="large-3 medium-3 small-4 columns"> <div class="large-3 medium-3 small-4 columns">
<div class="size-12"> <div class="size-12">
<span>{{out.value |noFractionNumber}} {{$root.wallet.settings.unitName}}</span> <span>{{out.value}} {{$root.wallet.settings.unitName}}</span>
<span class="label secondary round"> <span class="label secondary round">
{{out.alternativeAmount|noFractionNumber}} {{out.alternativeIsoCode}} {{out.alternativeAmount}} {{out.alternativeIsoCode}}
</span> </span>
</div> </div>
</div> </div>
@ -106,7 +106,7 @@
{{tx.missingSignatures}} signatures missing {{tx.missingSignatures}} signatures missing
</div> </div>
<div class="ellipsis small text-gray show-for-large-up m5t"> <div class="ellipsis small text-gray show-for-large-up m5t">
<strong translate>Fee</strong>: {{tx.fee|noFractionNumber}} {{$root.wallet.settings.unitName}} <strong translate>Fee</strong>: {{tx.fee}} {{$root.wallet.settings.unitName}}
<strong translate>Proposal ID</strong>: {{tx.ntxid}} <strong translate>Proposal ID</strong>: {{tx.ntxid}}
</div> </div>
</div> </div>

View File

@ -136,13 +136,13 @@
</p> </p>
<p> <p>
<i>{{amount + defaultFee |noFractionNumber}} {{$root.wallet.settings.unitName}}</i> <i>{{amount + defaultFee}} {{$root.wallet.settings.unitName}}</i>
<span class="text-gray" ng-if="isRateAvailable"> <span class="text-gray" ng-if="isRateAvailable">
{{ rateService.toFiat((amount + defaultFee) * unitToSatoshi, alternativeIsoCode) | noFractionNumber: 2 }} {{ alternativeIsoCode }} {{ alternativeAmountPayPro }} {{ alternativeIsoCode }}
</span> </span>
<span class="text-gray" > <span class="text-gray" >
(<span translate>Including fee of</span> (<span translate>Including fee of</span>
{{defaultFee|noFractionNumber}} {{defaultFee}}
{{$root.wallet.settings.unitName}}) {{$root.wallet.settings.unitName}})
</span> </span>
<p> <p>
@ -185,10 +185,10 @@
</div> </div>
</div><!-- end of row --> </div><!-- end of row -->
<div class="row m20b" ng-show="$root.alternativeConversionRate > 0"> <div class="row m20b" ng-show="$root.wallet.balanceInfo.alternativeConversionRate > 0">
<div class="large-12 columns size-12"> <div class="large-12 columns size-12">
<i class="fi-bitcoin-circle"></i> <i class="fi-bitcoin-circle"></i>
1 BTC = {{alternativeConversionRate|noFractionNumber:2}} {{alternativeIsoCode}} 1 BTC = {{$root.wallet.balanceInfo.alternativeConversionRate}} {{alternativeIsoCode}}
</div> </div>
</div> </div>