From 07a04a4cd88b5e59d483d27894943e20471930cf Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Mon, 8 Oct 2018 22:11:05 -0400 Subject: [PATCH 1/8] Adding overage alert to advanced payout. --- app/assets/v2/js/pages/bulk_payout.js | 14 +++++++ .../templates/bulk_payout_bounty.html | 41 ++++++++++++++++++- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index be26beef91f..81800a12354 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -209,9 +209,23 @@ var update_registry = 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 addr = web3.eth.coinbase.substring(38); $('#total_cost').html(tc + ' ' + denomination); $('#total_net').html(net + ' ' + denomination); + $('#total_overage').html(over + ' ' + denomination); + $('#address_ending').html(addr + ' '); + $('#preview_ending').html(addr + ' '); + $('#preview_overage').html(over + ' ' + denomination); + + if (over > 0) { + $('.overageAlert').css('display', 'inline-block'); + $('.overagePreview').css('display', 'inline-block'); + } else { + $('.overageAlert').css('display', 'none'); + $('.overagePreview').css('display', 'none'); + } let transactions = []; diff --git a/app/dashboard/templates/bulk_payout_bounty.html b/app/dashboard/templates/bulk_payout_bounty.html index 84bc08c0c95..6c967f69943 100644 --- a/app/dashboard/templates/bulk_payout_bounty.html +++ b/app/dashboard/templates/bulk_payout_bounty.html @@ -99,6 +99,14 @@

{% 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 ..." %}

+
+
@@ -108,7 +116,7 @@

{% trans "Advanced Payout" %}

{% 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:' %}

@@ -215,7 +223,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' %} From 2996a154aa7c1394387cad24795a121d0e77c0e0 Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Mon, 8 Oct 2018 22:19:18 -0400 Subject: [PATCH 2/8] Removing id to avoid id repetition. --- app/assets/v2/js/pages/bulk_payout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index 81800a12354..07a7cbac7fe 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -162,7 +162,7 @@ $(document).ready(function($) {
- +
` + percent + `
From 6594e32794f4b267a7d3d3c42dc5d2f51a30b1b3 Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Tue, 9 Oct 2018 11:50:13 -0400 Subject: [PATCH 3/8] Fixing get_total_cost. --- app/assets/v2/js/pages/bulk_payout.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index 07a7cbac7fe..bd566c730a9 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -185,12 +185,12 @@ $(document).ready(function($) { }); var get_total_cost = function() { - var num_rows = $('#payout_table tbody').find('tr').length; + var num_rows = $('#payout_table').find('tr').length; var total = 0; var i = 1; for (i = 1; i < num_rows; i += 1) { - var $row = $('#payout_table tobdy').find('tr:nth-child(' + i + ')'); + var $row = $('#payout_table').find('tr:nth-child(' + i + ')'); var amount = parseFloat($row.find('.amount').text()); var username = $row.find('.username-search').text(); var is_error = !$.isNumeric(amount) || amount <= 0 || username == '' || username == '@'; From 345e5dc10981b0f9435b4d13caedaeddf27c5b3d Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Thu, 11 Oct 2018 11:55:00 -0400 Subject: [PATCH 4/8] Restructuring advanced payout. --- app/assets/v2/css/bulk_payout_bounty.css | 122 ++++++++++++++++++ app/assets/v2/js/pages/bulk_payout.js | 8 +- .../templates/bulk_payout_bounty.html | 120 +---------------- 3 files changed, 128 insertions(+), 122 deletions(-) create mode 100644 app/assets/v2/css/bulk_payout_bounty.css diff --git a/app/assets/v2/css/bulk_payout_bounty.css b/app/assets/v2/css/bulk_payout_bounty.css new file mode 100644 index 00000000000..da24a15efc8 --- /dev/null +++ b/app/assets/v2/css/bulk_payout_bounty.css @@ -0,0 +1,122 @@ +#tooltip--hover { + min-height: 37%; + top: 17rem; +} + +@media only screen and (max-width: 1400px) { + #tooltip--hover { + top: 18.5rem; + } +} + +@media only screen and (max-width: 750px) { + #tooltip--hover { + min-height: 30%; + } +} + +@media only screen and (max-width: 400px) { + #tooltip--hover { + min-height: 33%; + left: 70px; + top: 20.5rem; + } +} + +#transaction_registry { + width: 100%; +} + +#transaction_registry tr td { + padding: 10px; + border: #333 solid 1px; +} + +#trans_preview { + padding: 5px; + border-radius: 3px; + background-color: #fafafa; + position: absolute; + top: 5rem; + right: -20rem; +} + +#trans_preview h5 { + color: #08cf7b; +} + +#primary_form { + margin: 0px 25%; +} + +@media (max-width: 1100px) { + #primary_form { + margin: 0px 15%; + } +} + +@media (max-width: 900px) { + #primary_form { + margin: 0px 5%; + } +} + +@media (max-width: 750px) { + #trans_preview { + position: unset; + top: 200px; + left: 72%; + width: 100%; + } + #primary_form { + margin: 0px auto; + } +} + +tr div { + border-radius: 3px; + padding: 5px; +} + +.error { + border: 1px solid red !important; +} + +.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; +} diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index bd566c730a9..694d3dcfa13 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -214,14 +214,14 @@ var update_registry = function() { $('#total_cost').html(tc + ' ' + denomination); $('#total_net').html(net + ' ' + denomination); - $('#total_overage').html(over + ' ' + denomination); - $('#address_ending').html(addr + ' '); - $('#preview_ending').html(addr + ' '); - $('#preview_overage').html(over + ' ' + denomination); if (over > 0) { $('.overageAlert').css('display', 'inline-block'); $('.overagePreview').css('display', 'inline-block'); + $('#total_overage').html(over + ' ' + denomination); + $('#address_ending').html(addr + ' '); + $('#preview_ending').html(addr + ' '); + $('#preview_overage').html(over + ' ' + denomination); } 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 6c967f69943..605499ad10b 100644 --- a/app/dashboard/templates/bulk_payout_bounty.html +++ b/app/dashboard/templates/bulk_payout_bounty.html @@ -22,32 +22,7 @@ {% include 'shared/cards.html' %} {% include 'shared/current_profile.html' %} - + @@ -147,13 +122,8 @@
{% trans 'Payout Preview' %}
{% trans "Payout Bounty" %} - - Your transaction is secured by the Ethereum blockchain.
- Learn more here. -
- - +
{% trans "Where is my Eth Going?" %}
@@ -168,92 +138,6 @@
{% trans 'Payout Preview' %}
- {% include 'shared/bottom_notification.html' %} {% include 'shared/analytics.html' %} {% include 'shared/footer_scripts.html' %} From 33abb8012bdf504b30c7bf444d8217c864ea8266 Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Fri, 12 Oct 2018 13:26:31 -0400 Subject: [PATCH 5/8] Refactoring for tbody inclusion. --- app/assets/v2/js/pages/bulk_payout.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index 694d3dcfa13..8c92c95840f 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -185,12 +185,11 @@ $(document).ready(function($) { }); var get_total_cost = function() { - var num_rows = $('#payout_table').find('tr').length; + var num_rows = $('#payout_table tbody').find('tr').length + 1; var total = 0; - var i = 1; - for (i = 1; i < num_rows; i += 1) { - var $row = $('#payout_table').find('tr:nth-child(' + i + ')'); + for (let i = 1; i < num_rows; i += 1) { + var $row = $('#payout_table tbody').find('tr:nth-child(' + i + ')'); var amount = parseFloat($row.find('.amount').text()); var username = $row.find('.username-search').text(); var is_error = !$.isNumeric(amount) || amount <= 0 || username == '' || username == '@'; From b3f01e5f91c4797f6480c7e06df5f6e1b2a3962e Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Sat, 13 Oct 2018 12:37:08 -0400 Subject: [PATCH 6/8] Rewriting get_total_cost function. --- app/assets/v2/js/pages/bulk_payout.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index 8c92c95840f..5d6fb9c8198 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -185,20 +185,20 @@ $(document).ready(function($) { }); var get_total_cost = function() { - var num_rows = $('#payout_table tbody').find('tr').length + 1; var total = 0; - for (let i = 1; i < num_rows; i += 1) { - var $row = $('#payout_table tbody').find('tr:nth-child(' + i + ')'); - var amount = parseFloat($row.find('.amount').text()); - var username = $row.find('.username-search').text(); + $('#payout_table tbody tr').each(function() { + var amount = parseFloat($(this).find('.amount').text()); + var username = $(this).find('.username-search').text(); var is_error = !$.isNumeric(amount) || amount <= 0 || username == '' || username == '@'; if (!is_error) { total += amount; } - } + }); + return total; + }; var update_registry = function() { From 4304e8ebb0a0d2c405eee70a9f816df5a3557f36 Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Sat, 13 Oct 2018 14:02:49 -0400 Subject: [PATCH 7/8] Fixing for callback. --- app/assets/v2/js/pages/bulk_payout.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index 5d6fb9c8198..98c255f132d 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -185,20 +185,20 @@ $(document).ready(function($) { }); var get_total_cost = function() { + var rows = $('#payout_table tbody tr'); var total = 0; - $('#payout_table tbody tr').each(function() { - var amount = parseFloat($(this).find('.amount').text()); - var username = $(this).find('.username-search').text(); + for (i = 0; i < rows.length; i += 1) { + var $rows = $(rows[i]); + var amount = parseFloat($rows.find('.amount').text()); + var username = $rows.find('.username-search').text(); var is_error = !$.isNumeric(amount) || amount <= 0 || username == '' || username == '@'; if (!is_error) { total += amount; } - }); - + } return total; - }; var update_registry = function() { From adf13dfefca5fa32473094f51c75de8a417b2446 Mon Sep 17 00:00:00 2001 From: Anish-Agnihotri Date: Fri, 19 Oct 2018 22:01:55 -0400 Subject: [PATCH 8/8] Adding changes according to @pinkiebell --- app/assets/v2/css/bulk_payout_bounty.css | 6 +++--- app/assets/v2/js/pages/bulk_payout.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/v2/css/bulk_payout_bounty.css b/app/assets/v2/css/bulk_payout_bounty.css index da24a15efc8..757dbb8753f 100644 --- a/app/assets/v2/css/bulk_payout_bounty.css +++ b/app/assets/v2/css/bulk_payout_bounty.css @@ -96,13 +96,13 @@ tr div { padding-left: 15px; } -.overageAlert>div:first-child { +.overageAlert > div:first-child { width: 25px; float: left; padding-right: 10px; } -.overageAlert>div:last-child { +.overageAlert > div:last-child { width: calc(100% - 40px); float: left; margin-left: 15px; @@ -110,7 +110,7 @@ tr div { padding-top: 6.5px; } -.overageAlert>div:first-child>img { +.overageAlert > div:first-child > img { width: 17px; margin-top: 10px; } diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index 98c255f132d..f87e20013c0 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -162,7 +162,7 @@ $(document).ready(function($) {
- +
` + percent + `