js: Use three-part progressbar when no middle goal defined.

Since our current fundraiser doesn't have a "middle goal," this makes
it a little easier to maintain the template and do the math.
This commit is contained in:
Brett Smith 2016-11-29 13:13:40 -05:00
parent df52029777
commit 8cb1f3f685

View file

@ -48,19 +48,21 @@ $(document).ready(function() {
if (noCommaSiteSoFar >= noCommaSiteMiddleGoal) {
// We've got
var leftOver = noCommaMatchFinalGoal - noCommaSiteSoFar;
var supporterProgress = (noCommaSiteSoFar / noCommaSiteFinalGoal) * 100;
var matchProgress = (noCommaSiteMatchCount / noCommaSiteFinalGoal) * 100;
var needProgress = 100 - matchProgress;
$('#siteprogressbar').
multiprogressbar({ parts: [
{ value: (noCommaSiteSoFar / noCommaSiteFinalGoal) * 100,
{ value: supporterProgress,
text: noCommaSiteSoFar.toLocaleString() + " have joined!",
barClass: "progress", textClass: "soFarText" },
{ value:
((noCommaMatchFinalGoal - noCommaSiteMiddleGoal) / noCommaSiteFinalGoal) * 100,
text: leftOver.toLocaleString() + " more needed to save license compliance work.",
{ value: needProgress,
text: leftOver.toLocaleString() + " more needed",
barClass: "final-goal", textClass: "goalText" },
{ value: 100,
text: siteMatchCount + " matched!",
barClass: "progress", textClass: "soFarText" },
{ value: 100,
text: noCommaSiteMatchCount.toLocaleString() + " matched!",
barClass: "progress", textClass: "soFarText" },
]});
} else {
$('#siteprogressbar').