Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing advanced payout - Default to Bountied Amount for Payment, etc. #2365

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions app/assets/v2/js/pages/bulk_payout.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $(document).ready(function($) {
self.html(self.html().replace(/(<([^>]+)>)/ig, ''));
}, 10);
});


$(document).on('click', '#close_bounty', function(event) {
update_registry();
Expand Down Expand Up @@ -68,8 +68,12 @@ $(document).ready(function($) {

$(document).on('click', '.remove', function(event) {
event.preventDefault();
var position = ($(this).parents('tr').index()+2).toString();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected blank line after variable declarations. (newline-after-var)
Infix operators must be spaced. (space-infix-ops)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Infix operators must be spaced. (space-infix-ops)


$('#transaction_registry tr:nth-child(' + position + ')').remove();
$(this).parents('tr').remove();
$(this).focus();
update_registry();
});

var sendTransaction = function(i) {
Expand Down Expand Up @@ -157,7 +161,7 @@ $(document).ready(function($) {

$('#acceptBounty').click(function(e) {
e.preventDefault();

if (!$('#terms').is(':checked')) {
_alert('Please accept the TOS.', 'error');
return;
Expand All @@ -166,7 +170,16 @@ $(document).ready(function($) {
_alert('You do not have any transactions to payout. Please add payees to the form.', 'error');
return;
}
var usernames = $('.username');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

encourage moving to let / const as opposed to var ?
cause we've got the ES6 support coming in this week


for (var i = 0; i < usernames.length; i++) {
var username = usernames[i].textContent.trim();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


if (username === null || username === '' || username === '@') {
_alert('Please provide a valid recipient Github username', 'error');
return;
}
}
sendTransaction(0);
});

Expand Down Expand Up @@ -212,11 +225,25 @@ $(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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Infix operators must be spaced. (space-infix-ops)

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 = {
Expand Down
84 changes: 78 additions & 6 deletions app/dashboard/templates/bulk_payout_bounty.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,34 @@
<head>
{% include 'shared/head.html' %}
{% include 'shared/cards.html' %}
{% include 'shared/current_profile.html' %}
<link rel="stylesheet" type="text/css" href="{% static "v2/css/tooltip_hover.css" %}">
<style type="text/css">
#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;
}
}
</style>
</head>

<body class="interior {{ active }} g-font-muli">
Expand Down Expand Up @@ -71,19 +99,24 @@ <h3>{% trans "Advanced Payout" %}</h3>
<input type="hidden" id="original_amount" value="{{ bounty.value_true }}">
<span id="token_name">{{ bounty.token_name }}</span>
</div>
<div class="w-100 mt-2 terms_container">
<input name='close_bounty' id='close_bounty' type="checkbox" value=1 checked="checked" />
<label for=close_bounty>{% blocktrans %}Return the bounty stake to me, thereby closing the bounty.{% endblocktrans %}</label>
<div class="w-100 overageAlert">
<div>
<img src="{% static "v2/images/warning.svg" %}">
</div>
<div>
<p>{% trans "You have exceeded the bounty's funded amount. The difference of " %}<span id="total_overage"></span> {% trans "will be paid from your metamask wallet ending in ..." %}<span id="address_ending"></span></p>
</div>
</div>
<div class="w-100 mt-2">
<label for=bountyFulfillment>{% trans "Payout" %}</label>
<label id="tooltip">{% trans "Where is my Eth going? " %}<i class='fa fa-info-circle'></i></label>
<div>
<div class="w-100 mt-2" style="display: inline-block;">
{% include 'shared/bulk_payout_form.html' %}
</div>
<div class="mt-2" id="trans_preview">
<h5>{% trans 'Payout Preview' %}</h5>
<p class="mb-0">{% trans 'Refunded' %}: <span id="total_returned">{{ bounty.value_true }} {{ bounty.token_name }}</span></p>
<p class="mb-0 overagePreview"><strong><span id="preview_overage"></span>{% trans ' to be paid from wallet ending in ...' %}<span id="preview_ending"></span></strong></p>
<p class="mb-0">{% trans 'Paid' %}: -<span id="total_cost"></span></p>
<p class="mb-0">{% trans 'Net' %}: <span id="total_net"></span></p>
<p class="mt-1 mb-0">{% trans 'Transactions:' %}</p>
Expand Down Expand Up @@ -120,6 +153,15 @@ <h5>{% trans 'Payout Preview' %}</h5>
</a>
</div>
</div>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the extra line ?

</div>
<div id="tooltip--hover">
<span id="heading">{% trans "Where is my Eth Going?" %}</span><br>
<span id="subheading">{% trans "Your funds are safe!" %}</span><br><br>
<span id="hovertext"><strong>{% trans "Unverified Users" %}</strong> <em>{% trans "(no eth address associated)" %}</em><br>
{% 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." %}<br><br>
<strong>{% trans "Verified Users" %}</strong><br>
{% trans "We send the funds directly to the address associated with the user." %}</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -181,7 +223,36 @@ <h5>{% trans 'Payout Preview' %}</h5>
.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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> - cosmetic whitespace missing 😄

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;
}
</style>
{% include 'shared/bottom_notification.html' %}
{% include 'shared/analytics.html' %}
Expand All @@ -201,5 +272,6 @@ <h5>{% trans 'Payout Preview' %}</h5>
<script src="{% static "v2/js/secrets.min.js" %}"></script>
<script src="{% static "v2/js/ethereumjs-accounts.js" %}"></script>
<script src="{% static "onepager/js/send.js" %}"></script>

<script src="{% static "v2/js/truncate-hash.js" %}"></script>
<script src="{% static "v2/js/user-search.js" %}"></script>
</html>