Skip to content

Commit

Permalink
txn history in 12h email (#9774)
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki authored Nov 30, 2021
1 parent d2464c2 commit 29f5fa7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/retail/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,12 @@ def render_new_contributions_email(grant):
'show_polygon_amount': False if amount_raised_polygon < 1 else True,
'num_of_contributors': num_of_contributors,
'media_url': settings.MEDIA_URL,
'contributions': contributions,
'utm_tracking': build_utm_tracking('new_contributions'),
}
response_html = premailer_transform(render_to_string("emails/grants/new_contributions.html", params))
response_txt = render_to_string("emails/grants/new_contributions.txt", params)
subject = _("You have new Grant contributions!")
subject = f"You have {contributions.count()} new Grant contributions worth ${round(amount_raised, 2)}!"

if amount_raised < 1:
# trigger to prevent email sending for negligible amounts
Expand Down
35 changes: 35 additions & 0 deletions app/retail/templates/emails/grants/new_contributions.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@
margin-top: 0 !important;
}
}
#transaction_history{
margin: 0px auto;
}
#transaction_history tr{
margin-left: 10px;
}
#transaction_history td{
padding: 10px;
}
#transaction_history tr.row td{
border-top: 1px solid #777;
}
</style>
<div id="content-body">
<img class="center-img bounties-img" src="{% static 'v2/images/emails/grants.png' %}">
Expand Down Expand Up @@ -127,6 +139,29 @@ <h1 style="text-transform: none; font-weight: normal; font-size: 36px;">New Cont
Grants Page</a>
</p>
</div>
<hr style="margin-left: 0; margin-top: 40px;">
<h3>The {{contributions.count}} Contributions: </h3>
<table id=transaction_history>
{% for contribution in contributions %}
{% with subscription=contribution.subscription %}
<tr class="row">
<td>
{{contribution.created_on|naturaltime}}
</td>
<td>
<img style="height: 20px; width:20px; border-radius: 10px;" src="https://gitcoin.co/dynamic/avatar/{{subscription.contributor_profile.handle}}">
<a href="https://gitcoin.co/{{subscription.contributor_profile.handle}}">{{subscription.contributor_profile.handle}}</a>
</td>
<td>
{{subscription.amount_per_period|floatformat:4}} {{subscription.token_symbol}}
</td>
<td>
<a href="{{contribution.blockexplorer_url_split_txid}}">view &gt;&gt;</a>
</td>
</tr>
{% endwith %}
{% endfor %}
</table>
</div>

{% endblock %}

0 comments on commit 29f5fa7

Please sign in to comment.