Skip to content

Commit

Permalink
on the user's profile, make the tip button open the QR code for the B…
Browse files Browse the repository at this point in the history
…CH address and remove the PayPal form. #1820 (#1846)
  • Loading branch information
Sarthak5598 authored Feb 28, 2024
1 parent d4210da commit 84cad21
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions website/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
.hide-issue-form {
padding-top: 10px;
}

</style>
{% endblock style %}
{% block content %}
Expand Down Expand Up @@ -214,21 +215,11 @@ <h1 class="page-header text-capitalize">{{ user.username }}</h1>
{% endif %}
{% endif %}
<div class="status">
<form name="_xclick"
action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden"
name="business"
value="{{ project.paypal|default:" [email protected]" }}">
<input type="hidden"
name="item_name"
value="tip for {{ user.username }} on {% env 'DOMAIN_NAME' %}">
<input type="hidden" name="currency_code" value="USD">
<button type="submit" class="btn btn-danger text-black">
<i class="fa fa-money fa-lg"></i> {% trans "Send a tip" %}
</button>
</form>
<button type="button" id="openModal" class="btn btn-danger">Send a Tip</button>
<dialog id="dialog">
<img id="qr-image" alt="QR Code" width="400" height="400">
<p id="bch-address">BCH: {{ user.userprofile.crypto_address }}</p>
</dialog>
</div>
</div>
<div class="icon-block">
Expand Down Expand Up @@ -421,6 +412,13 @@ <h1 class="page-header text-capitalize">{{ user.username }}</h1>
</div>
</div>
<script type="text/javascript">
document.getElementById('openModal').addEventListener('click', function() {
var address = "{{ user.userprofile.crypto_address }}";
var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?data=bitcoincash:" + address + "&size=400x400";
document.getElementById('qr-image').src = qrUrl;
document.getElementById('dialog').showModal();
});

$(function () {
$('.img-thumbnail, .upload-btn').on('mouseenter', function () {
$('.upload-btn').show();
Expand Down

0 comments on commit 84cad21

Please sign in to comment.