Skip to content

Commit

Permalink
enables tweet about grant again
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Aug 30, 2019
1 parent 81e8513 commit 47a3750
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
3 changes: 3 additions & 0 deletions app/assets/v2/css/grants/fund.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#grant-link {
color: #0D0764;
}
.tab_target{
width: 100%;
}

.banner-img {
max-height: 22rem;
Expand Down
4 changes: 2 additions & 2 deletions app/assets/v2/js/grants/fund.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ const subscribeToGrant = (transactionHash) => {
$('#transaction_url').attr('href', linkURL);
enableWaitState('#grants_form');
// TODO: fix the tweet modal
// $('#tweetModal').modal('show');
$('#tweetModal').css('display', 'block');

deployedSubscription.methods.extraNonce(accounts[0]).call(function(err, nonce) {

Expand Down Expand Up @@ -412,7 +412,7 @@ const splitPayment = (account, toFirst, toSecond, valueFirst, valueSecond) => {
$('#transaction_url').attr('href', linkURL);
enableWaitState('#grants_form');
// TODO: Fix tweet modal
// $('#tweetModal').modal('show');
$('#tweetModal').css('display', 'block');
}).on('confirmation', function(confirmationNumber, receipt) {
data = {
'subscription_hash': 'onetime',
Expand Down
15 changes: 12 additions & 3 deletions app/grants/templates/grants/fund.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ <h5 class="form__label">{% trans "Gas Settings" %}</h5>
</div>

</div>
<div class="modal fade" id="tweetModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal" id="tweetModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="margin-top: 10px;">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="javascript:$('#tweetModal').remove();">
<span aria-hidden="true">&times;</span>
</button>
</div>
Expand All @@ -340,7 +340,7 @@ <h5>Thanks for Contributing!</h5>
<span>{% trans "Tell your network about this Gitcoin Grant. If they fund a grant, the grant owner will get even more Matching Funds!" %}</span>
</div>
<div class="row my-4 justify-content-center">
<a class="button button--primary" role="button" href="https://twitter.com/intent/tweet?text=I just funded this grant on Gitcoin.co! https://{{ request.META.HTTP_HOST }}{% url 'grants:details' grant.id grant.slug %}"
<a class="button button--primary" role="button" href="https://twitter.com/intent/tweet?text=I just funded this grant on @gitcoin => https://{{ request.META.HTTP_HOST }}{% url 'grants:details' grant.id grant.slug %}"
target="_blank" rel="noopener noreferrer" OnClick="ga('send', 'event', 'Tweet Button', 'click', 'Grant Funder')">
{% trans "Tweet About it!" %}
</a>
Expand All @@ -353,6 +353,15 @@ <h5>Thanks for Contributing!</h5>
{% include 'shared/footer_scripts.html' %}
{% include 'shared/footer.html' %}
{% include 'grants/shared/shared_scripts.html' %}

{% if show_tweet_modal %}
<script>
$(document).ready(function(){
$('#tweetModal').css('display', 'block');
});
</script>
{% endif %}

</body>

<script src="{% static "v2/js/pages/wallet_estimate.js" %}"></script>
Expand Down
3 changes: 3 additions & 0 deletions app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,14 @@ def grant_fund(request, grant_id, grant_slug):
can_phantom_fund = request.user.is_authenticated and request.user.groups.filter(name='phantom_funders').exists()
phantom_funds = PhantomFunding.objects.filter(profile=request.user.profile, grant=grant, round_number=round_number)
is_phantom_funding_this_grant = request.user.is_authenticated and phantom_funds.exists()
show_tweet_modal = False
if can_phantom_fund:
active_tab = 'phantom'
if can_phantom_fund and request.GET.get('toggle_phantom_fund'):
if is_phantom_funding_this_grant:
msg = "You are now signaling for this grant."
phantom_funds.delete()
show_tweet_modal = True
else:
msg = "You are no longer signaling for this grant."
PhantomFunding.objects.create(grant=grant, profile=request.user.profile, round_number=round_number)
Expand All @@ -560,6 +562,7 @@ def grant_fund(request, grant_id, grant_slug):
'title': _('Fund Grant'),
'card_desc': _('Provide sustainable funding for Open Source with Gitcoin Grants'),
'subscription': {},
'show_tweet_modal': show_tweet_modal,
'grant_has_no_token': True if grant.token_address == '0x0000000000000000000000000000000000000000' else False,
'grant': grant,
'keywords': get_keywords(),
Expand Down
2 changes: 0 additions & 2 deletions app/retail/templates/shared/footer_scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
<script src="{% static "v2/js/lib/popper.min.js" %}"></script>
<script src="{% static "v2/js/lib/bootstrap.min.js" %}" crossorigin="anonymous"></script>
<script>
const bootstrapModal = $.fn.modal.noConflict()

This comment has been minimized.

Copy link
@owocki

owocki Sep 11, 2019

Author Contributor

hey @gitcoinco/engineers i think this might break modals across the site... i fixed it at f778359

$.fn.bootstrapModal = bootstrapModal
const bootstrapTooltip = $.fn.tooltip.noConflict()
$.fn.bootstrapTooltip = bootstrapTooltip;

Expand Down

0 comments on commit 47a3750

Please sign in to comment.