Skip to content

Commit

Permalink
display voucher fundings in diff category from the regular (actually …
Browse files Browse the repository at this point in the history
…transfered) fundings
  • Loading branch information
owocki committed Jan 14, 2020
1 parent e1fd8dc commit 7c520ca
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 51 deletions.
65 changes: 15 additions & 50 deletions app/grants/templates/grants/activity.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% if subscriptions %}
<div id="active-subscriptions">
<p class="font-body font-weight-semibold subtitle mb-0">
<i class="g-icon g-icon__dot-circle mr-2"></i>{% trans "Active Subscriptions" %}
<i class="g-icon g-icon__dot-circle mr-2"></i>{% trans "Active Subscriptions" %} ({{subscriptions|length}})
</p>
{% for subscription in subscriptions %}
<div class="py-3 mx-sm-0 row transaction-history">
Expand Down Expand Up @@ -56,64 +56,29 @@
<hr>
<div id="contributions">
<p class="font-body font-weight-semibold subtitle mb-0">
<i class="g-icon g-icon__dot-circle mr-2"></i> {% trans "Contributions" %}
<i class="g-icon g-icon__dot-circle mr-2"></i> {% trans "Contributions" %} ({{contributions|length}})
</p>
{% for transaction in contributions %}
<div class="py-3 mx-sm-0 row transaction-history">
<div class="d-none d-sm-block col-2 font-subheader text-center text-md-left my-auto">
{{ transaction.created_on|date:"d M Y" }}
</div>
<div class="col-3 col-sm-2 col-md-1 justify-content-center special_tag">
<a href="{% url 'profile' transaction.subscription.contributor_profile.handle %}">
<img class="avatar rounded-circle" src="{{ transaction.subscription.contributor_profile.avatar_url }}">
</a>
</div>
<div class="col-5 col-sm-4 my-auto">
<div class="font-weight-bold font-body">
<a href="{% url 'profile' transaction.subscription.contributor_profile.handle %}">
{{ transaction.subscription.contributor_profile }}
</a>
</div>
<div class="info font-caption">
{{ transaction.subscription.amount_per_period|floatformat:4|intcomma }} {{ transaction.subscription.token_symbol }}
{% if not transaction.tx_cleared %} (Pending) {% endif %}
{% if not transaction.success %} (Failed) {% endif %}
</div>
</div>
{% if not transaction.subscription.contributor_profile.hide_wallet_address %}
<div class="d-none d-md-block col-md-2 font-body my-auto txn-link">
<a class="tx_link" href="https://etherscan.io/tx/{{ transaction.tx_id }}" target="_blank" rel="noopener noreferrer">
{% if transaction.tx_id %}
View Etherscan
{% endif %}
</a>
</div>
{% endif %}
<div class="offset-lg-1 col-4 col-md-2 my-auto tags font-caption">
<div class="tag tag-lg token">
<p>
{{ transaction.subscription.amount_per_period|floatformat:4|intcomma }}
<span>{{ transaction.subscription.token_symbol }}</span>
</p>
</div>
{% if transaction.value_in_usdt_now %}
<div class="tag tag-lg usd">
<p>
{{ transaction.value_in_usdt_now }}
<span>USD</span>
</p>
</div>
{% endif %}
</div>
</div>
{% include 'grants/transaction.html' %}
{% endfor %}
</div>
{% endif %}
{% if voucher_fundings %}
<hr>
<div id="contributions">
<p class="font-body font-weight-semibold subtitle mb-0">
<i class="g-icon g-icon__dot-circle mr-2"></i> {% trans "Voucher Fundings" %} ({{voucher_fundings|length}})
</p>
{% for transaction in voucher_fundings %}
{% include 'grants/transaction.html' %}
{% endfor %}
</div>
{% endif %}
{% if cancelled_subscriptions %}
<hr>
<div id="cancelled-subscriptions">
<p class="font-body font-weight-semibold subtitle mb-0">
<i class="g-icon g-icon__dot-circle mr-2"></i> {% trans "Inactive Subscriptions" %}
<i class="g-icon g-icon__dot-circle mr-2"></i> {% trans "Inactive Subscriptions" %} ({{cancelled_subscriptions|length}})
</p>
{% for subscription in cancelled_subscriptions %}
<div class="py-3 mx-sm-0 row transaction-history">
Expand Down
48 changes: 48 additions & 0 deletions app/grants/templates/grants/transaction.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{% load static humanize i18n grants_extra %}
<div class="py-3 mx-sm-0 row transaction-history">
<div class="d-none d-sm-block col-2 font-subheader text-center text-md-left my-auto">
{{ transaction.created_on|date:"d M Y" }}
</div>
<div class="col-3 col-sm-2 col-md-1 justify-content-center special_tag">
<a href="{% url 'profile' transaction.subscription.contributor_profile.handle %}">
<img class="avatar rounded-circle" src="{{ transaction.subscription.contributor_profile.avatar_url }}">
</a>
</div>
<div class="col-5 col-sm-4 my-auto">
<div class="font-weight-bold font-body">
<a href="{% url 'profile' transaction.subscription.contributor_profile.handle %}">
{{ transaction.subscription.contributor_profile }}
</a>
</div>
<div class="info font-caption">
{{ transaction.subscription.amount_per_period|floatformat:4|intcomma }} {{ transaction.subscription.token_symbol }}
{% if not transaction.tx_cleared %} (Pending) {% endif %}
{% if not transaction.success %} (Failed) {% endif %}
</div>
</div>
{% if not transaction.subscription.contributor_profile.hide_wallet_address %}
<div class="d-none d-md-block col-md-2 font-body my-auto txn-link">
<a class="tx_link" href="https://etherscan.io/tx/{{ transaction.tx_id }}" target="_blank" rel="noopener noreferrer">
{% if transaction.tx_id %}
View Etherscan
{% endif %}
</a>
</div>
{% endif %}
<div class="offset-lg-1 col-4 col-md-2 my-auto tags font-caption">
<div class="tag tag-lg token">
<p>
{{ transaction.subscription.amount_per_period|floatformat:4|intcomma }}
<span>{{ transaction.subscription.token_symbol }}</span>
</p>
</div>
{% if transaction.value_in_usdt_now %}
<div class="tag tag-lg usd">
<p>
{{ transaction.value_in_usdt_now }}
<span>USD</span>
</p>
</div>
{% endif %}
</div>
</div>
4 changes: 3 additions & 1 deletion app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ def grant_details(request, grant_id, grant_slug):
cancelled_subscriptions = grant.subscriptions.filter(active=False, error=False).order_by('-created_on')
_contributions = Contribution.objects.filter(subscription__in=grant.subscriptions.all())
phantom_funds = grant.phantom_funding.all()
contributions = list(_contributions.order_by('-created_on')) + [ele.to_mock_contribution() for ele in phantom_funds.order_by('-created_on')]
contributions = list(_contributions.order_by('-created_on'))
voucher_fundings = [ele.to_mock_contribution() for ele in phantom_funds.order_by('-created_on')]
contributors = list(_contributions.distinct('subscription__contributor_profile')) + list(phantom_funds.distinct('profile'))
activity_count = len(cancelled_subscriptions) + len(contributions)
user_subscription = grant.subscriptions.filter(contributor_profile=profile, active=True).first()
Expand Down Expand Up @@ -298,6 +299,7 @@ def grant_details(request, grant_id, grant_slug):
'contributors': contributors,
'clr_active': clr_active,
'is_team_member': is_team_member,
'voucher_fundings': voucher_fundings,
}

if tab == 'stats':
Expand Down

0 comments on commit 7c520ca

Please sign in to comment.