From cffc81b5d8848bc115a99a18ed154a0f0a892b61 2016-01-19 03:50:08 From: Bradley M. Kuhn Date: 2016-01-19 03:50:08 Subject: [PATCH] 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. --- diff --git a/www/conservancy/static/js/supporter-page.js b/www/conservancy/static/js/supporter-page.js index a7f415a2a01744a22b2955a1047e41d95f22e886..4096d6202ffb19138c10d28e24554b6226cafb7f 100644 --- a/www/conservancy/static/js/supporter-page.js +++ b/www/conservancy/static/js/supporter-page.js @@ -31,24 +31,41 @@ $(document).ready(function() { var incrementDonationCount = Math.round( (riseLevelPercent / 100) * noCommaDonationCount ); $('#siteprogressbar').empty(); - $('#siteprogressbar'). - multiprogressbar({ parts: [ - { value: (noCommaSiteSoFar / noCommaSiteFinalGoal) * 100, - text: siteSoFar + " joined!", - barClass: "progress", textClass: "soFarText" }, - { value: ((noCommaSiteMiddleGoal - noCommaSiteSoFar) / noCommaSiteFinalGoal) * 100, - text: siteMiddleGoal + " will save our basic work", - barClass: "middle-goal", textClass: "goalText" }, - { value: - ((noCommaMatchFinalGoal - noCommaSiteMiddleGoal) / noCommaSiteFinalGoal) * 100, - text: noCommaMatchFinalGoal.toLocaleString() + " will save license compliance", - barClass: "final-goal", textClass: "goalText" }, - { value: 100, - text: siteMatchCount + " matched!", - barClass: "progress", textClass: "soFarText" }, - - ]}); - + 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, + text: siteSoFar + " joined!", + barClass: "progress", textClass: "soFarText" }, + { value: ((noCommaSiteMiddleGoal - noCommaSiteSoFar) / noCommaSiteFinalGoal) * 100, + text: siteMiddleGoal + " will save our basic work", + barClass: "middle-goal", textClass: "goalText" }, + { value: + ((noCommaMatchFinalGoal - noCommaSiteMiddleGoal) / noCommaSiteFinalGoal) * 100, + text: noCommaMatchFinalGoal.toLocaleString() + " will save license compliance", + barClass: "final-goal", textClass: "goalText" }, + { value: 100, + text: siteMatchCount + " matched!", + barClass: "progress", textClass: "soFarText" }, + ]}); + } $('span#fundraiser-percentage').css({ 'color' : 'green', 'font-weight' : 'bold', 'float' : 'right', diff --git a/www/conservancy/templates/base_conservancy.html b/www/conservancy/templates/base_conservancy.html index bd293bdf13fcd30152ac5b38711ef27a70194a40..31d297af627626025d6fcc003775371ce15da342 100644 --- a/www/conservancy/templates/base_conservancy.html +++ b/www/conservancy/templates/base_conservancy.html @@ -43,19 +43,31 @@
+{% if sitefundgoal.fundraiser_so_far_amount < 750 %} Conservancy needs {{ sitefundgoal.fundraiser_donation_count|intcomma }} Supporters to continue its basic community services & {{ sitefundgoal.fundraiser_goal_amount|intcomma }} to avoid hibernating its enforcement efforts! +{% else %} + Conservancy will continue our basic community services, thanks to our + first 750 Supporters! However, we still need + {{ sitefundgoal.fundraiser_donation_count|intcomma }} 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 by January 31 will count twice, thanks to Private Internet Access! {% endif %} -