Prepare for Supporters beyond 750.

After the next import, we'll have more than 750 supporters.  This change
not only handles that fact, but adds sufficient Javascript and Django
templating to handle the case if the Supporter count for any reason
drops below 750 again.
This commit is contained in:
Bradley M. Kuhn 2016-01-18 19:50:08 -08:00
parent 5d0969ec11
commit cffc81b5d8
2 changed files with 50 additions and 21 deletions

View file

@ -31,6 +31,24 @@ $(document).ready(function() {
var incrementDonationCount = Math.round( (riseLevelPercent / 100) * noCommaDonationCount );
$('#siteprogressbar').empty();
if (noCommaSiteSoFar > noCommaSiteMiddleGoal) {
// We've got
var moreCount = noCommaSiteSoFar - noCommaSiteMiddleGoal;
moreCount = moreCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
$('#siteprogressbar').
multiprogressbar({ parts: [
{ value: (noCommaSiteSoFar / noCommaSiteFinalGoal) * 100,
text: "750 achieved! " + moreCount + " beyond that have joined!",
barClass: "progress", textClass: "soFarText" },
{ value:
((noCommaMatchFinalGoal - noCommaSiteMiddleGoal) / noCommaSiteFinalGoal) * 100,
text: noCommaMatchFinalGoal.toLocaleString() + " will save license compliance work",
barClass: "final-goal", textClass: "goalText" },
{ value: 100,
text: siteMatchCount + " matched!",
barClass: "progress", textClass: "soFarText" },
]});
} else {
$('#siteprogressbar').
multiprogressbar({ parts: [
{ value: (noCommaSiteSoFar / noCommaSiteFinalGoal) * 100,
@ -46,9 +64,8 @@ $(document).ready(function() {
{ value: 100,
text: siteMatchCount + " matched!",
barClass: "progress", textClass: "soFarText" },
]});
}
$('span#fundraiser-percentage').css({ 'color' : 'green',
'font-weight' : 'bold',
'float' : 'right',

View file

@ -43,19 +43,31 @@
</div>
<div class="fundraiser-top-text">
{% if sitefundgoal.fundraiser_so_far_amount < 750 %}
<em>Conservancy
<a href="/supporter/">needs <span id="site-fundraiser-middle-goal">{{ sitefundgoal.fundraiser_donation_count|intcomma }}</span> Supporters</a> to continue its basic community services &amp;
<span id="site-fundraiser-final-goal">{{ sitefundgoal.fundraiser_goal_amount|intcomma }}</span> to
avoid hibernating its enforcement efforts!
{% else %}
<em>Conservancy will continue our basic community services, thanks to our
first 750 Supporters! However, we still need
<span id="site-fundraiser-middle-goal">{{ sitefundgoal.fundraiser_donation_count|intcomma }}</span> Supporters to avoid reducing licensing work and hibernating our
enforcement efforts!
{% endif %}
{% if sitefundgoal.fundraiser_donation_count_disclose_threshold < 632 %}
The next {{ 632|subtract:sitefundgoal.fundraiser_donation_count_disclose_threshold }} supporters
who sign up <a href="/news/2015/dec/24/private-internet-access-match/">by January 31 will count twice</a>, thanks to <a href="https://www.privateinternetaccess.com/">Private Internet Access</a>!
{% endif %}
</em>
<a href="/supporter"><div id="siteprogressbar">
<span id="site-fundraiser-so-far">{{ sitefundgoal.fundraiser_so_far_amount|intcomma }}</span> have joined so far
<div id="siteprogressbar">
<a href="/supporter">
<span id="site-fundraiser-so-far">{{ sitefundgoal.fundraiser_so_far_amount|intcomma }}</span> have joined so far.
{% if sitefundgoal.fundraiser_so_far_amount > 750 %}
Thus, our 750 goal was achieved and {{ sitefundgoal.fundraiser_so_far_amount|subtract:750|intcomma }}</span> have
joined beyond that.
{% endif %}
{% if sitefundgoal.fundraiser_donation_count_disclose_threshold > 0 %}
and match pledges reduced our 2,500 maximum need by <span id="site-fundraiser-match-count">{{ sitefundgoal.fundraiser_donation_count_disclose_threshold|min:632|intcomma }}</span>
Also, match pledges reduced our 2,500 maximum need by <span id="site-fundraiser-match-count">{{ sitefundgoal.fundraiser_donation_count_disclose_threshold|min:632|intcomma }}</span>
{% endif %}
!</div></a>
</div>