1
0
mirror of https://github.com/bigchaindb/site.git synced 2025-02-10 16:09:00 +01:00

add transaction link, disable post button by default

This commit is contained in:
Matthias Kretschmann 2017-06-23 13:11:19 +02:00
parent a8f9f6c913
commit ebe0336437
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 12 additions and 6 deletions

View File

@ -24,13 +24,11 @@ window.addEventListener('DOMContentLoaded', function domload(event){
const messageInput = document.getElementById('message')
// quick form validation
postButton.classList.add('disabled')
messageInput.addEventListener('input', function() {
if (messageInput.value === '') {
postButton.classList.add('disabled')
postButton.setAttribute('disabled', '')
} else {
postButton.classList.remove('disabled')
postButton.removeAttribute('disabled')
}
})
@ -60,6 +58,7 @@ window.addEventListener('DOMContentLoaded', function domload(event){
const output = document.getElementsByClassName('output')[0]
const messageSuccess = document.getElementsByClassName('message--success')[0]
const messageFail = document.getElementsByClassName('message--fail')[0]
const transactionLink = document.getElementsByClassName('transaction-link')[0]
conn.postTransaction(txSigned)
.then((response) => {
@ -72,6 +71,8 @@ window.addEventListener('DOMContentLoaded', function domload(event){
const outputContent = JSON.stringify(response, null, 4) // indented with 4 spaces
output.textContent = outputContent
transactionLink.href = 'https://test.ipdb.io/api/v1/transactions/' + response.id
}, reason => { // Error!
console.log(reason)

View File

@ -29,7 +29,7 @@ redirect_from:
<p class="form-group message">
A transaction can contain a digital asset along with a message. Type something to be sent along the asset.
</p>
<a class="btn btn-primary" id="post" href="#">Off you go</a>
<button class="btn btn-primary" id="post" disabled>Off you go</button>
</form>
</div>
<div class="grid__col">
@ -53,7 +53,12 @@ redirect_from:
</pre>
</div>
<p class="message message--success hide">Nicely done! You have just created an asset, sent it along in a signed transaction and retrieved the result of that transaction. Phew.</p>
<div class="message message--success hide">
<p>
Nicely done! You have just created an asset, sent it along in a signed transaction and retrieved the result of that transaction. Phew.
</p>
<p><a class="transaction-link" href="https://test.ipdb.io/api/v1/transactions/">Check out your transaction on IPDB</a></p>
</div>
<p class="message message--fail hide">Shenanigans! Something's off. Would you mind trying again?</p>
</div>
</div>