Make additional bar when time left with donation exceeding goal

This is a first draft of making another bar appear after the
completed "matched!" bar that will show how much extra we've gotten
beyond the match amount.
This commit is contained in:
Bradley M. Kuhn 2022-01-04 14:05:16 -08:00
parent f22dd3306b
commit c586ffb383

View file

@ -103,16 +103,17 @@
* this_match_goal: The amount being matched * this_match_goal: The amount being matched
* this_match_so_far: The amount contributed so far * this_match_so_far: The amount contributed so far
* this_match_remaining: this_match_goal - this_match_so_far * this_match_remaining: this_match_goal - this_match_so_far
* this_match_exceeded: this_match_so_far - this_match_goal
{% endcomment %} {% endcomment %}
{% if sitefundgoal and sitefundgoal.fundraiser_so_far_amount and datetime_now < sitefundgoal.fundraiser_endtime %} {% if sitefundgoal and sitefundgoal.fundraiser_so_far_amount and datetime_now < sitefundgoal.fundraiser_endtime %}
{% with this_match_goal=sitefundgoal.fundraiser_goal_amount this_match_so_far=sitefundgoal.fundraiser_so_far_amount %} {% with this_match_goal=sitefundgoal.fundraiser_goal_amount this_match_so_far=sitefundgoal.fundraiser_so_far_amount %}
{% with this_match_remaining=this_match_goal|subtract:this_match_so_far sitefundgoal_timeleft=sitefundgoal.fundraiser_endtime|subtract:datetime_now %} {% with this_match_remaining=this_match_goal|subtract:this_match_so_far sitefundgoal_timeleft=sitefundgoal.fundraiser_endtime|subtract:datetime_now this_match_exceeded=this_match_so_far|subtract:this_match_goal %}
<div class="fundraiser-top-text ph3 pt2 pb3"> <div class="fundraiser-top-text ph3 pt2 pb3">
<div class="mw8 center ph2 ph4-ns"> <div class="mw8 center ph2 ph4-ns">
<div class="mt2 mb3 tc"> <div class="mt2 mb3 tc">
{% if this_match_remaining <= 0 %} {% if this_match_remaining <= 0 %}
Thanks to {{ sitegoal.fundraiser_donation_count|intcomma }} Sustainers we earned our full match! Thanks to so many donors, we earned our full match!
Help us go further to stand up for software freedom &mdash; <a href="/sustainer">sign up now</a>! Help us go further to stand up for software freedom &mdash; <a href="/sustainer">sign up now</a>!
{% else %} {% else %}
{% if sitefundgoal_timeleft.total_seconds <= 0 %} {% if sitefundgoal_timeleft.total_seconds <= 0 %}
@ -137,6 +138,8 @@
{% if this_match_remaining <= 0 %} {% if this_match_remaining <= 0 %}
<div class="progress matched pv1 b flex" style="flex-basis: {{ this_match_so_far }}px"> <div class="progress matched pv1 b flex" style="flex-basis: {{ this_match_so_far }}px">
<span id="site-fundraiser-match-count" class="soFarText tc w-100">${{ this_match_goal|floatformat:0|intcomma }} matched!</span> <span id="site-fundraiser-match-count" class="soFarText tc w-100">${{ this_match_goal|floatformat:0|intcomma }} matched!</span>
<div class="progress matched pv1 b flex" style="flex-basis: {{ this_match_exceeded }}px">
<span id="site-fundraiser-match-count" class="soFarText tc w-100">${{this_match_exceeded|floatformat:0|intcomma }} extra given!</span>
</div> </div>
{% else %} {% else %}
<div class="progress pv1 b flex items-center" style="flex-basis: {{ this_match_so_far }}px"> <div class="progress pv1 b flex items-center" style="flex-basis: {{ this_match_so_far }}px">