diff --git a/www/conservancy/apps/fundgoal/models.py b/www/conservancy/apps/fundgoal/models.py index e208a22e5d5023bf421c616b8ca6da6063772570..704b75286f37e35e10eee9170b8ad075425fb3bb 100644 --- a/www/conservancy/apps/fundgoal/models.py +++ b/www/conservancy/apps/fundgoal/models.py @@ -7,6 +7,8 @@ class FundraisingGoal(models.Model): fundraiser_code_name = models.CharField(max_length=200, blank=False, unique=True) fundraiser_goal_amount = models.DecimalField(max_digits=10, decimal_places=2) fundraiser_so_far_amount = models.DecimalField(max_digits=10, decimal_places=2) + fundraiser_donation_count = models.IntegerField() + fundraiser_donation_count_disclose_threshold = models.IntegerField() def __unicode__(self): return self.fundraiser_code_name diff --git a/www/conservancy/static/npoacct/index.html b/www/conservancy/static/npoacct/index.html index f8a40ee69232760b48d93d56d26dcad5c4c5b8b1..029653ecffe11e1a6bb2de0bf48af67da64d3b3a 100644 --- a/www/conservancy/static/npoacct/index.html +++ b/www/conservancy/static/npoacct/index.html @@ -104,6 +104,9 @@ el.attachEvent('on'+ev, function() {handler.apply(el);}); -->

Support NPO Accounting Project Now!

+{% if fundgoal.fundraiser_donation_count > fundgoal.fundraiser_donation_count_disclose_threshold %} +Thanks to {{ fundgoal.fundraiser_donation_count|intcomma }} donations,
+{% endif %} ${{ fundgoal.fundraiser_so_far_amount|floatformat:0|intcomma }} raised toward
our ${{ fundgoal.fundraiser_goal_amount|floatformat:0|intcomma }} goal.
(i.e., {{ fundgoal.percentage_there|floatformat:1 }}%)
diff --git a/www/conservancy/static/supporter-page.js b/www/conservancy/static/supporter-page.js index 910c679d9c23d1196cfe8a5fea021884b575e4bc..fd7b34776acc551e0ae2b5875612ceb0598a1933 100644 --- a/www/conservancy/static/supporter-page.js +++ b/www/conservancy/static/supporter-page.js @@ -7,11 +7,14 @@ $(document).ready(function() { var goal = $('span#fundraiser-goal').text(); var soFar = $('span#fundraiser-so-far').text(); + var donationCount = $('span#fundraiser-donation-count').text(); var noCommaGoal = goal.replace(/,/g, ""); var noCommaSoFar = soFar.replace(/,/g, ""); + var noCommaDonationCount = parseInt(donationCount.replace(/,/g, "")); var percentage = (parseFloat(noCommaSoFar) / parseFloat(noCommaGoal)) * 100; var curValue = 0.00; var incrementSoFar = 0.00; + var incrementDonationCount = 0; $('span#fundraiser-percentage').text(""); $('span#fundraiser-percentage').css({ 'color' : 'green', @@ -22,7 +25,7 @@ $(document).ready(function() { 'text-align' : 'inherit'}); $("#progressbar").progressbar({ value: curValue }); - function slowRise() { + function riseDonationProgressBar() { if (curValue >= percentage) { $('span#fundraiser-so-far').text(soFar); $("#progressbar").progressbar({ value : percentage }); @@ -32,10 +35,22 @@ $(document).ready(function() { $("#progressbar").progressbar({ value: curValue }); $('span#fundraiser-so-far').text(newVal.toLocaleString()); curValue += 0.5; - setTimeout(slowRise, 50); + setTimeout(riseDonationProgressBar, 50); } } - slowRise(); + function riseDonationCount() { + if (incrementDonationCount >= noCommaDonationCount) { + $('span#fundraiser-donation-count').text(donationCount); + } else { + $('span#fundraiser-donation-count').text(incrementDonationCount.toLocaleString()); + incrementDonationCount++; + setTimeout(riseDonationCount, 50); + } + } + if (noCommaDonationCount > 0) { + riseDonationCount(); + } + riseDonationProgressBar(); $('.toggle-content').hide(); diff --git a/www/conservancy/templates/base_compliance.html b/www/conservancy/templates/base_compliance.html index 9c79e3314c6340a8accb3796b79c75148f86601e..0d4deaf40bc5c0e6d095aeb389067a75d3cff575 100644 --- a/www/conservancy/templates/base_compliance.html +++ b/www/conservancy/templates/base_compliance.html @@ -22,6 +22,9 @@

Support our GPL compliance work now &

{% cache 3600 compliancedonation fundgoal.fundraiser_so_far_amount %} +{% if fundgoal.fundraiser_donation_count > fundgoal.fundraiser_donation_count_disclose_threshold %} +Thanks to {{ fundgoal.fundraiser_donation_count|intcomma }} donations,
+{% endif %} ${{ fundgoal.fundraiser_so_far_amount|floatformat:0|intcomma }} of ${{ fundgoal.fundraiser_goal_amount|floatformat:0|intcomma }} match met.
(i.e., {{ fundgoal.percentage_there|floatformat:1 }}%)