From 35dbf0de9bb13c5276fb4033b1cf96a69d501066 Mon Sep 17 00:00:00 2001 From: Cofresi Date: Wed, 2 Nov 2016 19:57:15 -0400 Subject: [PATCH] automatic default adjustment of end date to one month after start date whenever start date is changed --- index.html | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index f79b2fa..9bbd597 100644 --- a/index.html +++ b/index.html @@ -112,7 +112,8 @@ console.log('blocks left to next superblock: ' + (selectblock - blockheight)); console.log('selectblock: ' + selectblock); console.log('budgetPaymentCycleBlocks: ' + budgetPaymentCycleBlocks); - //if next superblock is less than 3 days (60*24*3/2.6) away, select next month + + //if next superblock is less than 3 days (60*24*3/2.6) away, select next month's superblock by default so proposal has more time to be voted upon if (selectblock - blockheight < 1661) { selectblock += budgetPaymentCycleBlocks; blockdiff = selectblock - blockheight; @@ -126,6 +127,16 @@ } }); + //change end date to one month after start date by default + $('#start_epoch').change(function() { + console.log('start_epoch changed'); + var start_time = $('#start_epoch').val(); + console.log('start_epoch: ' + start_time); + var startindex = $('#start_epoch').find(":selected").index(); + var endindex = startindex + 1; + $('#end_epoch :nth-child(' + endindex + ')').prop('selected', true); + }); + $('#prepareProposal').click(function() { copyToClipboard($(this).attr('id')); @@ -177,7 +188,7 @@ var ProposalGenerator = function(gov) { this._mode = 'proposal'; this.gov = gov; - this.gov.network = 'testnet'; + this.gov.network = 'livenet'; // proposal basic fields this.gov.name = $('#name').val(); @@ -186,7 +197,7 @@ this.gov.payment_amount = parseFloat($('#payment_amount').val()); // format dates for gobject serialization - // this.gov.start_epoch = (new Date($('#start_epoch').val()) / 1000) || null; + this.gov.start_epoch = (new Date($('#start_epoch').val()) / 1000) || null; this.gov.end_epoch = (new Date($('#end_epoch').val()) / 1000) || null; // hidden elements