mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 14:56:10 +00:00
automatic default adjustment of end date to one month after start date whenever start date is changed
This commit is contained in:
parent
90054cc972
commit
35dbf0de9b
1 changed files with 14 additions and 3 deletions
17
index.html
17
index.html
|
@ -112,7 +112,8 @@
|
||||||
console.log('blocks left to next superblock: ' + (selectblock - blockheight));
|
console.log('blocks left to next superblock: ' + (selectblock - blockheight));
|
||||||
console.log('selectblock: ' + selectblock);
|
console.log('selectblock: ' + selectblock);
|
||||||
console.log('budgetPaymentCycleBlocks: ' + budgetPaymentCycleBlocks);
|
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) {
|
if (selectblock - blockheight < 1661) {
|
||||||
selectblock += budgetPaymentCycleBlocks;
|
selectblock += budgetPaymentCycleBlocks;
|
||||||
blockdiff = selectblock - blockheight;
|
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() {
|
$('#prepareProposal').click(function() {
|
||||||
copyToClipboard($(this).attr('id'));
|
copyToClipboard($(this).attr('id'));
|
||||||
|
@ -177,7 +188,7 @@
|
||||||
var ProposalGenerator = function(gov) {
|
var ProposalGenerator = function(gov) {
|
||||||
this._mode = 'proposal';
|
this._mode = 'proposal';
|
||||||
this.gov = gov;
|
this.gov = gov;
|
||||||
this.gov.network = 'testnet';
|
this.gov.network = 'livenet';
|
||||||
|
|
||||||
// proposal basic fields
|
// proposal basic fields
|
||||||
this.gov.name = $('#name').val();
|
this.gov.name = $('#name').val();
|
||||||
|
@ -186,7 +197,7 @@
|
||||||
this.gov.payment_amount = parseFloat($('#payment_amount').val());
|
this.gov.payment_amount = parseFloat($('#payment_amount').val());
|
||||||
|
|
||||||
// format dates for gobject serialization
|
// 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;
|
this.gov.end_epoch = (new Date($('#end_epoch').val()) / 1000) || null;
|
||||||
|
|
||||||
// hidden elements
|
// hidden elements
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue