From 37a439e6a0f52f8d12c04d0e0e1c87b08ca7fd14 Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Fri, 5 Oct 2018 16:15:35 -0400 Subject: [PATCH 1/4] Fixing advanced payout - Default to Bountied Amount for Payment, Add Guidance on Overage --- app/assets/v2/js/pages/bulk_payout.js | 31 ++++++- .../templates/bulk_payout_bounty.html | 82 +++++++++++++++++-- 2 files changed, 105 insertions(+), 8 deletions(-) diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index df7cadf6cd2..b4b08de5888 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -29,7 +29,7 @@ $(document).ready(function($) { self.html(self.html().replace(/(<([^>]+)>)/ig, '')); }, 10); }); - + $(document).on('click', '#close_bounty', function(event) { update_registry(); @@ -68,8 +68,11 @@ $(document).ready(function($) { $(document).on('click', '.remove', function(event) { event.preventDefault(); + var position = ($(this).parents('tr').index()+2).toString(); + $("#transaction_registry tr:nth-child(" + position + ")").remove(); $(this).parents('tr').remove(); $(this).focus(); + update_registry(); }); var sendTransaction = function(i) { @@ -157,7 +160,7 @@ $(document).ready(function($) { $('#acceptBounty').click(function(e) { e.preventDefault(); - + if (!$('#terms').is(':checked')) { _alert('Please accept the TOS.', 'error'); return; @@ -166,7 +169,16 @@ $(document).ready(function($) { _alert('You do not have any transactions to payout. Please add payees to the form.', 'error'); return; } + var usernames = $('.username'); + + for (var i = 0; i < usernames.length; i++) { + var username = usernames[i].textContent.trim(); + if (username === null || username === '' || username === '@') { + _alert('Please provide a valid recipient Github username', 'error'); + return; + } + } sendTransaction(0); }); @@ -212,11 +224,26 @@ $(document).ready(function($) { var denomination = $('#token_name').text(); var original_amount = $('#original_amount').val(); var net = round(original_amount - tc, 2); + var over = round(((original_amount) - (get_total_cost()))*-1, 4); var close_bounty = $('#close_bounty').is(':checked'); + var addr = web3.eth.coinbase.substring(38); + $('#total_overage').html(over + ' ' + denomination); + $('#address_ending').html(addr + ' '); + $('#preview_ending').html(addr + ' '); + $('#preview_overage').html(over + ' ' + denomination); $('#total_cost').html(tc + ' ' + denomination); $('#total_net').html(net + ' ' + denomination); + if (over > 0) { + $('.overageAlert').css('display', 'inline-block'); + $('.overagePreview').css('display', 'inline-block'); + } + else { + $('.overageAlert').css('display', 'none'); + $('.overagePreview').css('display', 'none'); + } + var transactions = []; first_transaction = { diff --git a/app/dashboard/templates/bulk_payout_bounty.html b/app/dashboard/templates/bulk_payout_bounty.html index f1c279a454a..d281bcf1205 100644 --- a/app/dashboard/templates/bulk_payout_bounty.html +++ b/app/dashboard/templates/bulk_payout_bounty.html @@ -20,6 +20,33 @@ {% include 'shared/head.html' %} {% include 'shared/cards.html' %} + + @@ -71,19 +98,24 @@

{% trans "Advanced Payout" %}

{{ bounty.token_name }} -
- - +
+
+ +
+
+

{% trans "You have exceeded the bounty's funded amount. The difference of " %} {% trans "will be paid from your metamask wallet ending in ..." %}

+
+
{% include 'shared/bulk_payout_form.html' %}
{% trans 'Payout Preview' %}
-

{% trans 'Refunded' %}: {{ bounty.value_true }} {{ bounty.token_name }}

+

{% trans ' to be paid from wallet ending in ...' %}

{% trans 'Paid' %}: -

{% trans 'Net' %}:

{% trans 'Transactions:' %}

@@ -120,6 +152,15 @@
{% trans 'Payout Preview' %}
+ +
+
+ {% trans "Where is my Eth Going?" %}
+ {% trans "Your funds are safe!" %}

+ {% trans "Unverified Users" %} {% trans "(no eth address associated)" %}
+ {% trans "A secure proxy address will hold the funds until the recipient claims them. This address is generated by gitcoin’s website, but we don't have its private keys, and the only person who can access the funds is the recipient." %}

+ {% trans "Verified Users" %}
+ {% trans "We send the funds directly to the address associated with the user." %}
@@ -181,7 +222,36 @@
{% trans 'Payout Preview' %}
.entry.active{ background-color: #bbb; } - + .overageAlert { + background-color: #E66700; + color: #FFF; + border-radius: 5px; + margin-top: 15px; + margin-bottom: 5px; + display: none; + padding-left: 15px; + } + .overageAlert > div:first-child { + width: 25px; + float: left; + padding-right: 10px; + } + .overageAlert> div:last-child { + width: calc(100% - 40px); + float: left; + margin-left: 15px; + padding-right: 15px; + padding-top: 6.5px; + } + .overageAlert > div:first-child > img { + width: 17px; + margin-top: 10px; + } + .overagePreview { + color: #E66700; + padding-bottom: 5px; + display: none; + } {% include 'shared/bottom_notification.html' %} {% include 'shared/analytics.html' %} @@ -201,5 +271,5 @@
{% trans 'Payout Preview' %}
- + From 1bd6864f6e99c1694bbd7fe9399616324bc5e50b Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Fri, 5 Oct 2018 16:35:02 -0400 Subject: [PATCH 2/4] Fixing advanced payout - lint errors, and merge conflicts. --- app/assets/v2/js/pages/bulk_payout.js | 8 ++++---- app/dashboard/templates/bulk_payout_bounty.html | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index b4b08de5888..b0986530c8a 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -69,7 +69,8 @@ $(document).ready(function($) { $(document).on('click', '.remove', function(event) { event.preventDefault(); var position = ($(this).parents('tr').index()+2).toString(); - $("#transaction_registry tr:nth-child(" + position + ")").remove(); + + $('#transaction_registry tr:nth-child(' + position + ')').remove(); $(this).parents('tr').remove(); $(this).focus(); update_registry(); @@ -224,7 +225,7 @@ $(document).ready(function($) { var denomination = $('#token_name').text(); var original_amount = $('#original_amount').val(); var net = round(original_amount - tc, 2); - var over = round(((original_amount) - (get_total_cost()))*-1, 4); + var over = round((original_amount - get_total_cost())*-1, 4); var close_bounty = $('#close_bounty').is(':checked'); var addr = web3.eth.coinbase.substring(38); @@ -238,8 +239,7 @@ $(document).ready(function($) { if (over > 0) { $('.overageAlert').css('display', 'inline-block'); $('.overagePreview').css('display', 'inline-block'); - } - else { + } else { $('.overageAlert').css('display', 'none'); $('.overagePreview').css('display', 'none'); } diff --git a/app/dashboard/templates/bulk_payout_bounty.html b/app/dashboard/templates/bulk_payout_bounty.html index d281bcf1205..b7bdc212461 100644 --- a/app/dashboard/templates/bulk_payout_bounty.html +++ b/app/dashboard/templates/bulk_payout_bounty.html @@ -20,6 +20,7 @@ {% include 'shared/head.html' %} {% include 'shared/cards.html' %} + {% include 'shared/current_profile.html' %}