Merge pull request #394 from cmgustavo/feature/01-hightlight-from-addr-spent

Feature/01 highlight input outputs
This commit is contained in:
Matias Alejo Garcia 2014-02-24 11:47:36 -02:00
commit f603657165
6 changed files with 63 additions and 56 deletions

View File

@ -568,9 +568,6 @@ margin-left: 0;
margin: 30px 0;
}
.transaction-vin-vout .ellipsis { margin-bottom: 10px; }
.transaction-vin-vout .btc-value { margin-left: 15px; }
.page-header { margin-top: 0; }
/* Index */
@ -646,3 +643,18 @@ margin-left: 0;
-webkit-animation-timing-function: linear;
}
.transaction-vin-vout {
}
.v_highlight {
background-color: #8DC429;
overflow: hidden;
color: #fff;
}
a.v_highlight_more {
background-color: #8DC429;
color: #fff;
}

View File

@ -11,7 +11,7 @@ angular.module('insight').config(function($routeProvider) {
controller: 'BlocksController',
templateUrl: '/views/redirect.html'
}).
when('/tx/:txId', {
when('/tx/:txId/:v_type?/:v_index?', {
templateUrl: '/views/transaction.html',
title: 'Bitcoin Transaction '
}).

View File

@ -58,14 +58,14 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans
tmp[addr].doubleSpentIndex = tmp[addr].doubleSpentIndex || items[i].doubleSpentIndex;
tmp[addr].unconfirmedInput += items[i].unconfirmedInput;
tmp[addr].dbError = tmp[addr].dbError || items[i].dbError;
tmp[addr].valueSat += items[i].value * COIN;
tmp[addr].valueSat += Math.round(items[i].value * COIN);
tmp[addr].items.push(items[i]);
tmp[addr].notAddr = notAddr;
tmp[addr].count++;
}
angular.forEach(tmp, function(v) {
v.value = parseInt(v.valueSat) / COIN;
v.value = v.value || parseInt(v.valueSat) / COIN;
ret.push(v);
});
return ret;
@ -154,6 +154,14 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans
}
};
// Highlighted txout
if ($routeParams.v_type == '>' || $routeParams.v_type == '<') {
$scope.from_vin = $routeParams.v_type == '<' ? true : false;
$scope.from_vout = $routeParams.v_type == '>' ? true : false;
$scope.v_index = parseInt($routeParams.v_index);
$scope.itemsExpanded = true;
}
//Init without txs
$scope.txs = [];

View File

@ -2,7 +2,6 @@
<section data-ng-controller="BlocksController" data-ng-init="findOne()">
<div class="row">
<div class="col-xs-12 col-gray col-gray-fixed">
<h1 class="text-center">Block</h1>
<div class="m20v text-center text-muted" data-ng-if="!block.hash">
<span>Loading Block...</span>
</div>
@ -16,7 +15,6 @@
<a class="ellipsis" href="/block/{{block.hash}}">{{block.hash}}</a>
</div>
<div class="m20v" data-ng-show="!tx.isCoinBase">
<h4>Hashes</h4>
<table class="table" style="table-layout: fixed">
<tbody class="small">
<tr data-ng-show="block.previousblockhash">
@ -35,7 +33,8 @@
</div> <!-- END OF COL-GRAY -->
<div class="col-xs-12 col-md-9 col-md-offset-3">
<h2>Summary</h2>
<h1>Block #{{block.height}}</h1>
<h3>Summary</h3>
<div class="progress progress-striped active" data-ng-if="!block.hash">
<div class="progress-bar progress-bar-info" style="width: 100%">
<span>Loading Block Details...</span>
@ -109,7 +108,7 @@
</div><!-- END OF ROW -->
<div data-ng-controller="transactionsController" data-ng-init="load('block')">
<h2>Transactions <small >Transactions contained within this block</small></h2>
<h3>Transactions</h3>
<div data-ng-include src="'/views/transaction/list.html'" when-scrolled="loadMore()"></div>
</div>
</div>

View File

@ -3,7 +3,6 @@
<div class="row ng-cloak" data-ng-cloak data-ng-if="tx.txid">
<div class="col-xs-12 col-gray col-gray-fixed">
<h1 class="text-center">Transaction</h1>
<div class="m20v text-center text-muted" data-ng-if="!tx.txid">
<span>Loading Transaction...</span>
</div>
@ -41,10 +40,13 @@
<div data-ng-include src="'/views/includes/currency.html'"></div>
</div>
<div class="col-xs-12 col-md-9 col-md-offset-3">
<h2>
Details
<small>View information about a bitcoin transaction</small>
</h2>
<h1>Transaction
<small data-ng-show="from_vin || from_vout">
<span data-ng-show="from_vin">Input</span>
<span data-ng-show="from_vout">Output</span>
<span>{{v_index}}</span>
</small>
</h1>
<div class="progress progress-striped active" data-ng-if="!tx.txid">
<div class="progress-bar progress-bar-info" style="width: 100%">
<span>Loading Transaction Details...</span>
@ -53,25 +55,6 @@
<div class="block-tx ng-cloak" data-ng-cloak data-ng-if="tx.txid">
<div data-ng-include src="'/views/transaction/tx.html'"></div>
</div>
<div class="ng-cloak" data-ng-cloak data-ng-if="tx.txid && !tx.isCoinBase">
<h2>Inputs and Outputs</h2>
<table class="table">
<tbody>
<tr>
<td><strong>Total Input</strong></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">{{$root.currency.getConvertion(tx.valueOut)}}</td>
</tr>
<tr>
<td><strong>Fees</strong></td>
<td class="text-muted text-right">{{$root.currency.getConvertion(tx.fees)}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>

View File

@ -51,12 +51,14 @@
</div>
<!-- Full view -->
<div data-ng-if="itemsExpanded" data-ng-init="currentInExpanded=0; sizeInExpanded=5">
<div data-ng-repeat="vin in tx.vin| startFrom:currentInExpanded*sizeInExpanded | limitTo:sizeInExpanded">
<div data-ng-if="itemsExpanded" data-ng-init="currentInExpanded=0; sizeInExpanded=(from_vin) ? tx.vin.length : 5; fromVinCollapsed=(from_vin)">
<a href="#" data-ng-show="(from_vin) && tx.vin.length > 1" data-ng-class="{'text-muted': fromVinCollapsed}" data-ng-click="currentInExpanded=0; sizeInExpanded=tx.vin.length;fromVinCollapsed=1"><small>show input {{ v_index }}</small></a>
<a href="#" data-ng-show="(from_vin) && tx.vin.length > 1" data-ng-class="{'text-muted': !fromVinCollapsed}" data-ng-click="currentInExpanded=0; sizeInExpanded=tx.vin.length;fromVinCollapsed=0"><small>show all</small></a>
<div data-ng-repeat="vin in tx.vin| startFrom:currentInExpanded*sizeInExpanded | limitTo:sizeInExpanded" data-ng-if="fromVinCollapsed ? v_index == vin.n : 1">
<div class="col-md-12 transaction-vin-vout">
<div class="pull-right btc-value"><p>{{$root.currency.getConvertion(vin.value)}}</p></div>
<div class="ellipsis">
<a class="glyphicon glyphicon-chevron-right" href="/tx/{{vin.txid}}" title="Outpoint: {{vin.txid}},{{vin.vout}}"></a>&nbsp;&nbsp;
<a class="glyphicon glyphicon-chevron-right" href="/tx/{{vin.txid}}/>/{{vin.vout}}" title="Outpoint: {{vin.txid}},{{vin.vout}}"></a>&nbsp;&nbsp;
<span data-ng-show="vin.notAddr">{{vin.addr}}</span>
<a href="/address/{{vin.addr}}" data-ng-show="!vin.notAddr">{{vin.addr}}</a>
</div>
@ -65,11 +67,10 @@
<div data-ng-show="vin.doubleSpentTxID" class="text-danger"> <span class="glyphicon glyphicon-warning-sign"></span> Double spent attempt detected. From tx:
<a href="/tx/{{vin.doubleSpentTxID}}">{{vin.doubleSpentTxID}},{{vin.doubleSpentIndex}}</a>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body" style="word-wrap:break-word">
<div class="panel-body" style="word-wrap:break-word" data-ng-class="{true: 'v_highlight', false: ''}[from_vin == true && v_index == vin.n]">
<small>
<strong>scriptSig</strong>
{{vin.scriptSig.asm}}
@ -78,18 +79,20 @@
</div>
</div>
</div>
<div class="showmore_collapse text-right" data-ng-show="tx.vin.length > 5" data-ng-class="{ 'hidden': !itemsExpanded}">
<div class="showmore_collapse text-right" data-ng-show="tx.vin.length > 5 && !fromVinCollapsed" data-ng-class="{ 'hidden': !itemsExpanded}">
<a href="#" ng-hide="sizeInExpanded != tx.vin.length" ng-click="currentInExpanded=0; sizeInExpanded=5"><small>...less</small></a>
<a href="#" ng-hide="currentInExpanded >= tx.vin.length/sizeInExpanded - 1" ng-click="currentInExpanded=0; sizeInExpanded=tx.vin.length"><small>more...</small></a>
<a href="#" data-ng-class="{true: 'v_highlight_more', false: ''}[from_vin == true && v_index > 5]" ng-hide="currentInExpanded >= tx.vin.length/sizeInExpanded - 1" ng-click="currentInExpanded=0; sizeInExpanded=tx.vin.length"><small>more...</small></a>
</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 class="col-md-1 col-xs-12">
<div class="hidden-xs hidden-sm text-center">
<span class="glyphicon glyphicon-chevron-right text-primary"></span>
</div>
<div class="hidden-md hidden-lg text-center">
<span class="glyphicon glyphicon-chevron-down text-primary"></span>
</div>
</div>
<div class="col-md-6">
<div class="row">
@ -101,9 +104,9 @@
<div class="pull-right btc-value" data-ng-class="{'text-success': $root.currentAddr == vout.addr}">
<p>
{{$root.currency.getConvertion(vout.value)}}
<span class="text-danger" data-ng-show="vout.isSpent" tooltip="Output is spent" tooltip-placement="left">(S)</span>
<span class="text-success" data-ng-show="!vout.isSpent" tooltip="Output is unspent" tooltip-placement="left">(U)</span>
{{$root.currency.getConvertion(vout.value)}}
<span class="text-danger" data-ng-show="vout.isSpent" tooltip="Output is spent" tooltip-placement="left">(S)</span>
<span class="text-success" data-ng-show="!vout.isSpent" tooltip="Output is unspent" tooltip-placement="left">(U)</span>
</p>
</div>
@ -121,13 +124,15 @@
</div>
<!-- Full view -->
<div data-ng-if="itemsExpanded" data-ng-init="currentOutExpanded=0; sizeOutExpanded=5">
<div data-ng-repeat="vout in tx.vout| startFrom:currentOutExpanded*sizeOutExpanded | limitTo:sizeOutExpanded">
<div data-ng-if="itemsExpanded" data-ng-init="currentOutExpanded=0; sizeOutExpanded=(from_vout) ? tx.vout.length : 5; fromVoutCollapsed=(from_vout)">
<a href="#" data-ng-show="(from_vout) && tx.vout.length > 1" data-ng-class="{'text-muted': fromVoutCollapsed}" data-ng-click="currentOutExpanded=0; sizeOutExpanded=tx.vout.length;fromVoutCollapsed=1"><small>show output {{ v_index }}</small></a>
<a href="#" data-ng-show="(from_vout) && tx.vout.length > 1" data-ng-class="{'text-muted': !fromVoutCollapsed}" data-ng-click="currentOutExpanded=0; sizeOutExpanded=tx.vout.length;fromVoutCollapsed=0"><small>show all</small></a>
<div data-ng-repeat="vout in tx.vout| startFrom:currentOutExpanded*sizeOutExpanded | limitTo:sizeOutExpanded" data-ng-if="fromVoutCollapsed ? v_index == vout.n : 1">
<div class="col-md-12 transaction-vin-vout">
<div class="pull-right btc-value">
<p>{{$root.currency.getConvertion(vout.value)}}
<span class="text-success" data-ng-show="!vout.spendTxId" tooltip="Output is unspent" tooltip-placement="left">(U)</span>
<a class="glyphicon glyphicon-chevron-right" data-ng-show="vout.spendTxId" href="/tx/{{vout.spendTxId}}" title="Spent at: {{vout.spendTxId}},{{vout.spendIndex}}"></a>&nbsp;&nbsp;
<span class="text-success" data-ng-show="!vout.spentTxId" tooltip="Output is unspent" tooltip-placement="left">(U)</span>
<a class="glyphicon glyphicon-chevron-right" data-ng-show="vout.spentTxId" href="/tx/{{vout.spentTxId}}/</{{vout.spentIndex}}" title="Spent at: {{vout.spentTxId}},{{vout.spentIndex}}"></a>&nbsp;&nbsp;
</p>
</div>
<div class="ellipsis">
@ -136,7 +141,7 @@
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body" style="word-wrap:break-word">
<div class="panel-body" style="word-wrap:break-word" data-ng-class="{true: 'v_highlight', false: ''}[from_vout == true && v_index == vout.n]">
<small>
<p>
<strong>Type</strong>
@ -151,9 +156,9 @@
</div>
</div>
</div>
<div class="showmore_collapse text-right" data-ng-show="tx.vout.length > 5" data-ng-class="{ 'hidden': !itemsExpanded}">
<div class="showmore_collapse text-right" data-ng-show="tx.vout.length > 5 && !fromVoutCollapsed" data-ng-class="{ 'hidden': !itemsExpanded}">
<a href="#" ng-hide="sizeOutExpanded != tx.vout.length" ng-click="currentOutExpanded=0; sizeOutExpanded=5"><small>...less</small></a>
<a href="#" ng-hide="currentOutExpanded >= tx.vout.length/sizeOutExpanded - 1" ng-click="currentOutExpanded=0; sizeOutExpanded=tx.vout.length"><small>more...</small></a>
<a href="#" data-ng-class="{true: 'v_highlight_more', false: ''}[from_vout == true && v_index > 5]" ng-hide="currentOutExpanded >= tx.vout.length/sizeOutExpanded - 1" ng-click="currentOutExpanded=0; sizeOutExpanded=tx.vout.length"><small>more...</small></a>
</div>
</div>
</div>