Changeset - 8b469cff1830
[Not reviewed]
0 4 0
Bradley Kuhn (bkuhn) - 9 years ago 2015-03-12 01:10:28
bkuhn@ebb.org
Support display of donation count in fundraiser.

Allow display of a donation count in the fundraiser pages, with an
optional threshold that must be met before it's displayed.
4 files changed with 26 insertions and 3 deletions:
0 comments (0 inline, 0 general)
www/conservancy/apps/fundgoal/models.py
Show inline comments
...
 
@@ -9,2 +9,4 @@ class FundraisingGoal(models.Model):
 
    fundraiser_so_far_amount = models.DecimalField(max_digits=10, decimal_places=2)
 
    fundraiser_donation_count = models.IntegerField()
 
    fundraiser_donation_count_disclose_threshold = models.IntegerField()
 

	
www/conservancy/static/npoacct/index.html
Show inline comments
...
 
@@ -106,2 +106,5 @@ el.attachEvent('on'+ev, function() {handler.apply(el);});
 
<h3>Support NPO Accounting Project Now!</h3>
 
{% if fundgoal.fundraiser_donation_count > fundgoal.fundraiser_donation_count_disclose_threshold %}
 
Thanks to <span id="fundraiser-donation-count">{{ fundgoal.fundraiser_donation_count|intcomma }}</span> donations,<br/>
 
{% endif %}
 
$<span id="fundraiser-so-far">{{ fundgoal.fundraiser_so_far_amount|floatformat:0|intcomma }}</span> raised toward<br/>
www/conservancy/static/supporter-page.js
Show inline comments
...
 
@@ -9,4 +9,6 @@ $(document).ready(function() {
 
    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;
...
 
@@ -14,2 +16,3 @@ $(document).ready(function() {
 
    var incrementSoFar = 0.00;
 
    var incrementDonationCount = 0;
 

	
...
 
@@ -24,3 +27,3 @@ $(document).ready(function() {
 

	
 
    function slowRise() {
 
    function riseDonationProgressBar() {
 
        if (curValue >= percentage) {
...
 
@@ -34,6 +37,18 @@ $(document).ready(function() {
 
            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();
 

	
www/conservancy/templates/base_compliance.html
Show inline comments
...
 
@@ -24,2 +24,5 @@
 
{% cache 3600 compliancedonation fundgoal.fundraiser_so_far_amount %}
 
{% if fundgoal.fundraiser_donation_count > fundgoal.fundraiser_donation_count_disclose_threshold %}
 
Thanks to <span id="fundraiser-donation-count">{{ fundgoal.fundraiser_donation_count|intcomma }}</span> donations,<br/>
 
{% endif %}
 
$<span id="fundraiser-so-far">{{ fundgoal.fundraiser_so_far_amount|floatformat:0|intcomma }}</span>
0 comments (0 inline, 0 general)