removed unnecessary CurrencyController calls
This commit is contained in:
parent
398babaa8f
commit
2a4d3f0252
|
@ -6,7 +6,26 @@ angular.module('insight.currency').controller('CurrencyController',
|
|||
$rootScope.currency = {
|
||||
factor: 1,
|
||||
bitstamp: 0,
|
||||
symbol: 'BTC'
|
||||
symbol: 'BTC',
|
||||
getConvertion: function(value) {
|
||||
if (typeof value !== 'undefined' && value !== null) {
|
||||
var response;
|
||||
|
||||
if (this.symbol === 'USD') {
|
||||
response = _roundFloat((value * this.factor), 2);
|
||||
} else if (this.symbol === 'mBTC') {
|
||||
this.factor = 1000;
|
||||
response = _roundFloat((value * this.factor), 5);
|
||||
} else {
|
||||
this.factor = 1;
|
||||
response = value;
|
||||
}
|
||||
|
||||
return response + ' ' + this.symbol;
|
||||
}
|
||||
|
||||
return 'value error';
|
||||
}
|
||||
};
|
||||
|
||||
var _roundFloat = function(x, n) {
|
||||
|
@ -29,26 +48,6 @@ angular.module('insight.currency').controller('CurrencyController',
|
|||
}
|
||||
};
|
||||
|
||||
$scope.getConvertion = function(value) {
|
||||
if (typeof value !== 'undefined' && value !== null) {
|
||||
var response;
|
||||
|
||||
if ($rootScope.currency.symbol === 'USD') {
|
||||
response = _roundFloat((value * $rootScope.currency.factor), 2);
|
||||
} else if ($rootScope.currency.symbol === 'mBTC') {
|
||||
$rootScope.currency.factor = 1000;
|
||||
response = _roundFloat((value * $rootScope.currency.factor), 5);
|
||||
} else {
|
||||
$rootScope.currency.factor = 1;
|
||||
response = value;
|
||||
}
|
||||
|
||||
return response + ' ' + $rootScope.currency.symbol;
|
||||
}
|
||||
|
||||
return 'value error';
|
||||
};
|
||||
|
||||
// Get initial value
|
||||
Currency.get({}, function(res) {
|
||||
$rootScope.currency.bitstamp = res.data.bitstamp;
|
||||
|
|
|
@ -12,19 +12,19 @@
|
|||
</div>
|
||||
<div class="m20v">
|
||||
<h4>Summary</h4>
|
||||
<table class="table" data-ng-controller="CurrencyController">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="small">Total Received</td>
|
||||
<td class="address ellipsis text-right">{{getConvertion(address.totalReceived)}}</td>
|
||||
<td class="address ellipsis text-right">{{$root.currency.getConvertion(address.totalReceived)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="small">Total Sent</td>
|
||||
<td class="address ellipsis text-right">{{getConvertion(address.totalSent)}}</td>
|
||||
<td class="address ellipsis text-right">{{$root.currency.getConvertion(address.totalSent)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="small">Final Balance</td>
|
||||
<td class="address ellipsis text-right">{{getConvertion(address.balance)}}</td>
|
||||
<td class="address ellipsis text-right">{{$root.currency.getConvertion(address.balance)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="small">No. Transactions</td>
|
||||
|
|
|
@ -37,19 +37,19 @@
|
|||
</div>
|
||||
<div data-ng-show="!tx.isCoinBase">
|
||||
<h2>Inputs and Outputs</h2>
|
||||
<table class="table" data-ng-controller="CurrencyController">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong>Total Input</strong></td>
|
||||
<td class="text-muted text-right">{{getConvertion(tx.valueIn)}}</td>
|
||||
<td class="text-muted text-right">{{$root.currency.getConvertion(tx.valueIn)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Total Output</strong></td>
|
||||
<td class="text-muted text-right">{{getConvertion(tx.valueOut)}}</td>
|
||||
<td class="text-muted text-right">{{$root.currency.getConvertion(tx.valueOut)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Fees</strong></td>
|
||||
<td class="text-muted text-right">{{getConvertion(tx.fees)}}</td>
|
||||
<td class="text-muted text-right">{{$root.currency.getConvertion(tx.fees)}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,121 +1,119 @@
|
|||
<div data-ng-controller="CurrencyController">
|
||||
<div class="line-bot row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<button class="btn-expand pull-left" data-ng-click="itemsExpanded = !itemsExpanded"><span class="glyphicon glyphicon-plus" data-ng-class="{'glyphicon-minus': itemsExpanded}" tooltip="Show/Hide items details" tooltip-placement="right"></span></button>
|
||||
<button class="btn-copy pull-right" clip-copy="tx.txid"></button>
|
||||
<div class="ellipsis">
|
||||
<a class="txid" href="/tx/{{tx.txid}}">{{tx.txid}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 text-right">
|
||||
<time>{{tx.time * 1000 | date:'medium'}}</time>
|
||||
<div class="line-bot row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<button class="btn-expand pull-left" data-ng-click="itemsExpanded = !itemsExpanded"><span class="glyphicon glyphicon-plus" data-ng-class="{'glyphicon-minus': itemsExpanded}" tooltip="Show/Hide items details" tooltip-placement="right"></span></button>
|
||||
<button class="btn-copy pull-right" clip-copy="tx.txid"></button>
|
||||
<div class="ellipsis">
|
||||
<a class="txid" href="/tx/{{tx.txid}}">{{tx.txid}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row line-mid">
|
||||
<div class="col-md-5">
|
||||
<div class="row" data-ng-show="tx.isCoinBase">
|
||||
<div class="col-md-12 transaction-vin-vout" data-ng-repeat="vin in tx.vin">
|
||||
<div class="text-muted pull-right btc-value"><small>{{getConvertion(vin.reward)}}</small></div>
|
||||
<div class="col-xs-12 col-md-6 text-right">
|
||||
<time>{{tx.time * 1000 | date:'medium'}}</time>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row line-mid">
|
||||
<div class="col-md-5">
|
||||
<div class="row" data-ng-show="tx.isCoinBase">
|
||||
<div class="col-md-12 transaction-vin-vout" data-ng-repeat="vin in tx.vin">
|
||||
<div class="text-muted pull-right btc-value"><small>{{$root.currency.getConvertion(vin.reward)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<span>No Inputs (Newly Generated Coins)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" data-ng-show="!tx.isCoinBase">
|
||||
<div data-ng-repeat="vin in tx.vinSimple" data-ng-show="!itemsExpanded">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value" data-ng-class="{'text-danger': $root.currentAddr == vin.addr}"><small>{{$root.currency.getConvertion(vin.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<span>No Inputs (Newly Generated Coins)</span>
|
||||
<span data-ng-show="vin.notAddr">{{vin.addr}}</span>
|
||||
<span class="text-muted" title="Current Bitcoin Address" data-ng-show="vin.addr == $root.currentAddr">{{vin.addr}}</span>
|
||||
<a href="/address/{{vin.addr}}" data-ng-show="!vin.notAddr && vin.addr != $root.currentAddr">{{vin.addr}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" data-ng-show="!tx.isCoinBase">
|
||||
<div data-ng-repeat="vin in tx.vinSimple" data-ng-show="!itemsExpanded">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value" data-ng-class="{'text-danger': $root.currentAddr == vin.addr}"><small>{{getConvertion(vin.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<span data-ng-show="vin.notAddr">{{vin.addr}}</span>
|
||||
<span class="text-muted" title="Current Bitcoin Address" data-ng-show="vin.addr == $root.currentAddr">{{vin.addr}}</span>
|
||||
<a href="/address/{{vin.addr}}" data-ng-show="!vin.notAddr && vin.addr != $root.currentAddr">{{vin.addr}}</a>
|
||||
</div>
|
||||
<div data-ng-repeat="vin in tx.vin" data-ng-show="itemsExpanded">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value"><small>{{$root.currency.getConvertion(vin.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<a class="glyphicon glyphicon-chevron-right" href="/#!/tx/{{vin.txid}}" title="Outpoint: {{vin.txid}},{{vin.vout}}"></a>
|
||||
<span data-ng-show="vin.notAddr">{{vin.addr}}</span>
|
||||
<a href="/address/{{vin.addr}}" data-ng-show="!vin.notAddr">{{vin.addr}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div data-ng-repeat="vin in tx.vin" data-ng-show="itemsExpanded">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value"><small>{{getConvertion(vin.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<a class="glyphicon glyphicon-chevron-right" href="/#!/tx/{{vin.txid}}" title="Outpoint: {{vin.txid}},{{vin.vout}}"></a>
|
||||
<span data-ng-show="vin.notAddr">{{vin.addr}}</span>
|
||||
<a href="/address/{{vin.addr}}" data-ng-show="!vin.notAddr">{{vin.addr}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" style="word-wrap:break-word">
|
||||
<small>
|
||||
<strong>scriptSig</strong>
|
||||
{{vin.scriptSig.asm}}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1 text-center hidden-xs hidden-sm">
|
||||
<span class="glyphicon glyphicon-chevron-right text-primary"></span>
|
||||
</div>
|
||||
<div class="col-xs-12 text-center hidden-md hidden-lg">
|
||||
<span class="glyphicon glyphicon-chevron-down text-primary"></span>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div data-ng-repeat="vout in tx.voutSimple" data-ng-show="!itemsExpanded">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value" data-ng-class="{'text-success': $root.currentAddr == vout.addr}"><small>{{getConvertion(vout.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<span data-ng-show="vout.notAddr">{{vout.addr}}</span>
|
||||
<span class="text-muted" title="Current Bitcoin Address" data-ng-show="address == $root.currentAddr" data-ng-repeat="address in vout.addr.split(',')">{{vout.addr}}</span>
|
||||
<a href="/address/{{address}}" data-ng-show="!vout.notAddr && address != $root.currentAddr" data-ng-repeat="address in vout.addr.split(',')">{{address}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-ng-repeat="vout in tx.vout" data-ng-show="itemsExpanded">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value"><small>{{getConvertion(vout.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<a href="/address/{{address}}" data-ng-repeat="address in vout.scriptPubKey.addresses">{{address}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" style="word-wrap:break-word">
|
||||
<small>
|
||||
<p>
|
||||
<strong>Type</strong>
|
||||
{{vout.scriptPubKey.type}}
|
||||
</p>
|
||||
<p>
|
||||
<strong>scriptPubKey</strong>
|
||||
{{vout.scriptPubKey.asm}}
|
||||
</p>
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" style="word-wrap:break-word">
|
||||
<small>
|
||||
<strong>scriptSig</strong>
|
||||
{{vin.scriptSig.asm}}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default" data-ng-show="itemsExpanded">
|
||||
<div class="panel-body" style="word-wrap:break-word">
|
||||
<small>
|
||||
<strong>BlockHash</strong>
|
||||
<a href="/block/{{tx.blockhash}}">{{tx.blockhash}}</a>
|
||||
<button class="btn-copy" clip-copy="tx.blockhash"></button>
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-md-1 text-center hidden-xs hidden-sm">
|
||||
<span class="glyphicon glyphicon-chevron-right text-primary"></span>
|
||||
</div>
|
||||
<div class="line-top row">
|
||||
<div class="col-xs-4 col-md-6">
|
||||
<button data-ng-show="!tx.isCoinBase" class="btn btn-default">Fees: {{getConvertion(tx.fees)}}</button>
|
||||
</div>
|
||||
<div class="col-xs-8 col-md-6 text-right">
|
||||
<button data-ng-show="tx.confirmations" class="btn btn-success">{{tx.confirmations}} Confirmations</button>
|
||||
<button data-ng-show="!tx.confirmations" class="btn btn-danger">Unconfirmed Transaction!</button>
|
||||
<button class="btn btn-primary">{{getConvertion(tx.valueOut)}}</button>
|
||||
<div class="col-xs-12 text-center hidden-md hidden-lg">
|
||||
<span class="glyphicon glyphicon-chevron-down text-primary"></span>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div data-ng-repeat="vout in tx.voutSimple" data-ng-show="!itemsExpanded">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value" data-ng-class="{'text-success': $root.currentAddr == vout.addr}"><small>{{$root.currency.getConvertion(vout.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<span data-ng-show="vout.notAddr">{{vout.addr}}</span>
|
||||
<span class="text-muted" title="Current Bitcoin Address" data-ng-show="address == $root.currentAddr" data-ng-repeat="address in vout.addr.split(',')">{{vout.addr}}</span>
|
||||
<a href="/address/{{address}}" data-ng-show="!vout.notAddr && address != $root.currentAddr" data-ng-repeat="address in vout.addr.split(',')">{{address}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-ng-repeat="vout in tx.vout" data-ng-show="itemsExpanded">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value"><small>{{$root.currency.getConvertion(vout.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
<a href="/address/{{address}}" data-ng-repeat="address in vout.scriptPubKey.addresses">{{address}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" style="word-wrap:break-word">
|
||||
<small>
|
||||
<p>
|
||||
<strong>Type</strong>
|
||||
{{vout.scriptPubKey.type}}
|
||||
</p>
|
||||
<p>
|
||||
<strong>scriptPubKey</strong>
|
||||
{{vout.scriptPubKey.asm}}
|
||||
</p>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default" data-ng-show="itemsExpanded">
|
||||
<div class="panel-body" style="word-wrap:break-word">
|
||||
<small>
|
||||
<strong>BlockHash</strong>
|
||||
<a href="/block/{{tx.blockhash}}">{{tx.blockhash}}</a>
|
||||
<button class="btn-copy" clip-copy="tx.blockhash"></button>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line-top row">
|
||||
<div class="col-xs-4 col-md-6">
|
||||
<button data-ng-show="!tx.isCoinBase" class="btn btn-default">Fees: {{$root.currency.getConvertion(tx.fees)}}</button>
|
||||
</div>
|
||||
<div class="col-xs-8 col-md-6 text-right">
|
||||
<button data-ng-show="tx.confirmations" class="btn btn-success">{{tx.confirmations}} Confirmations</button>
|
||||
<button data-ng-show="!tx.confirmations" class="btn btn-danger">Unconfirmed Transaction!</button>
|
||||
<button class="btn btn-primary">{{$root.currency.getConvertion(tx.valueOut)}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue