diff --git a/css/master.css b/css/master.css index 6f17f36..30d5847 100644 --- a/css/master.css +++ b/css/master.css @@ -36,7 +36,6 @@ i.fa { } .proposalBlock { - /*margin-top: 6%;*/ padding: 7%; background-color: #ffffff; box-shadow: 0px 17px 24px 0px rgba(0, 0, 0, 0.16); diff --git a/index.html b/index.html index 21919ab..b5a8c00 100755 --- a/index.html +++ b/index.html @@ -53,6 +53,11 @@ console.log("socket.io initialized..."); }); + socket.on('disconnect', function() { + console.log('connection lost'); + alert('We sorry; connection lost.'); + }); + return gov; }; @@ -97,6 +102,7 @@ document.getElementById('step_two').click(); document.getElementsByClassName('progress-bar')[0].style.width = "50%"; document.getElementsByClassName('progress-bar')[0].innerText = "Generated wallet commands"; + $('#network_toggle').addClass('hidden'); proposal.walletCommands(); @@ -108,6 +114,7 @@ $('#btnNew').click(function() { proposal.resetProposal(); + $('#network_toggle').removeClass('hidden'); }); } }); @@ -121,9 +128,19 @@ // check if tx exists in insight txListener.getTx(function(err, res) { - if(err) console.log(err); + if(err) { + console.log("Error:", err); + if(err == 404) { + $('#feeTxid').addClass('validationError'); + $('#feeTxid').val('Transaction ID not found'); + } else if (err == 400) { + $('#feeTxid').addClass('validationError'); + $('#feeTxid').val('Please paste a valid transaction ID'); + } + + } if(res) { - console.log(res); + console.log("Response:", res); // transaction exists, proceed to step three document.getElementById('step_three').click(); @@ -163,7 +180,7 @@
-
+
@@ -327,71 +344,75 @@
-
+
+
-
diff --git a/js/formHandler.js b/js/formHandler.js index 47ef5bc..98a6edf 100755 --- a/js/formHandler.js +++ b/js/formHandler.js @@ -9,7 +9,9 @@ function setFormEditable(edit) { if (edit === true) { $('#btnPrepare').addClass('hidden'); $('#btnEdit').removeClass('hidden'); + $('#btnEdit').removeAttr('disabled'); $('#btnNew').removeClass('hidden'); + $('#btnNew').removeAttr('disabled'); } else { $('#btnPrepare').removeClass('hidden'); $('#btnEdit').addClass('hidden'); @@ -20,4 +22,4 @@ function setFormEditable(edit) { var copyToClipboard = function(id) { document.getElementById(id).select(); document.execCommand('copy'); -}; \ No newline at end of file +}; diff --git a/js/proposalGenerator.js b/js/proposalGenerator.js index 5aea0eb..552ef47 100755 --- a/js/proposalGenerator.js +++ b/js/proposalGenerator.js @@ -115,5 +115,15 @@ ProposalGenerator.prototype.resetProposal = function() { $('.createProposal input').each(function() { $(this).val(''); }); - setFormEditable(true); + $("#btnEdit").val('Edit Proposal'); + $("#btnNew").val('New Proposal'); + $("#btnPrepare").val('Create Proposal'); + setFormEditable(false); + $('.walletCommands#walletCommandsHeader').addClass('hidden'); + $('.walletCommands#walletCommandsPrepare').addClass('hidden'); + $('.walletCommands#walletCommandsTx').addClass('hidden'); + $('.walletCommands#walletCommandsProgress').addClass('hidden'); + $('.walletCommands#walletCommandsSubmit').addClass('hidden'); + + this._mode = 'proposal'; }; diff --git a/js/txListener.js b/js/txListener.js index 7ef1bb9..83da36f 100755 --- a/js/txListener.js +++ b/js/txListener.js @@ -45,7 +45,6 @@ TXListener.prototype.getTx = function(cb) { format: "json" } }; - console.log(opts); this._fetch(opts, cb); }; @@ -80,7 +79,8 @@ TXListener.prototype._fetch = function(opts,cb) { cb(null, data); }, error: function (jqXHR, status, error) { - var err = eval("(" + jqXHR.responseText + ")"); + var err = jqXHR.status; + //var err = eval("(" + jqXHR.responseText + ")"); cb(err, null); } });