Skip to content

Commit

Permalink
Better UI for #150
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Flaxman committed Oct 17, 2015
1 parent 1217e6f commit c9af508
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
9 changes: 5 additions & 4 deletions addresses/templatetags/btc_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def txn_outputs_to_data_dict(txn_outputs):
https://github.com/blockcypher/explorer/issues/150#issuecomment-143899714
'''
for txn_output in txn_outputs:
if txn_output.get('data_hex'):
return {'data_hex': txn_output.get('data_hex'), 'data_string': None}
if txn_output.get('data_string'):
return {'data_hex': None, 'data_string': txn_output.get('data_string')}
if txn_output.get('data_hex') or txn_output.get('data_string'):
return {
'data_hex': txn_output.get('data_hex'),
'data_string': txn_output.get('data_string'),
}
22 changes: 19 additions & 3 deletions templates/transaction_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,33 @@ <h2 class="tagline wrapit semi">{{ tx_hash }}</h2>
<div class="alert alert-info" role="alert">
<i class="fa fa-exclamation-triangle"></i>
<strong>
{{ transaction.data_protocol }} transaction
{% if transaction.data_protocol == 'unknown' %}
Data Embedded in Transaction with Unknown Protocol
{% elif transaction.data_protocol == 'blockchainid' %}
BlockchainID Transaction
{% elif transaction.data_protocol == 'openassets' %}
Open Assets Transaction
{% elif transaction.data_protocol == 'factom' %}
Factom Transaction
{% elif transaction.data_protocol == 'colu' %}
Colu Transaction
{% elif transaction.data_protocol == 'coinspark' %}
CoinSpark Transaction
{% else %}
{# Catch all in case more are added #}
{{ transaction.data_protocol }} transaction
{% endif %}
</strong>
(<a href="http://dev.blockcypher.com/#tx">more</a>)
<br />
<p>
{% with data_dict=transaction.outputs|txn_outputs_to_data_dict %}
{% if data_dict.data_hex or data_dict.data_string %}
{% if data_dict.data_string %}
<strong>String</strong>: {{ data_dict.data_string }} <br />
{% endif %}
{% if data_dict.data_hex %}
<strong>Hex</strong>: {{ data_dict.data_hex }}
{% elif data_dict.data_string %}
<strong>String</strong>: {{ data_dict.data_hex }}
{% endif %}
{% endif %}
{% endwith %}
Expand Down

0 comments on commit c9af508

Please sign in to comment.