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:
parent
df52029777
commit
8cb1f3f685
1 changed files with 9 additions and 7 deletions
|
@ -48,19 +48,21 @@ $(document).ready(function() {
|
||||||
if (noCommaSiteSoFar >= noCommaSiteMiddleGoal) {
|
if (noCommaSiteSoFar >= noCommaSiteMiddleGoal) {
|
||||||
// We've got
|
// We've got
|
||||||
var leftOver = noCommaMatchFinalGoal - noCommaSiteSoFar;
|
var leftOver = noCommaMatchFinalGoal - noCommaSiteSoFar;
|
||||||
|
var supporterProgress = (noCommaSiteSoFar / noCommaSiteFinalGoal) * 100;
|
||||||
|
var matchProgress = (noCommaSiteMatchCount / noCommaSiteFinalGoal) * 100;
|
||||||
|
var needProgress = 100 - matchProgress;
|
||||||
|
|
||||||
$('#siteprogressbar').
|
$('#siteprogressbar').
|
||||||
multiprogressbar({ parts: [
|
multiprogressbar({ parts: [
|
||||||
{ value: (noCommaSiteSoFar / noCommaSiteFinalGoal) * 100,
|
{ value: supporterProgress,
|
||||||
text: noCommaSiteSoFar.toLocaleString() + " have joined!",
|
text: noCommaSiteSoFar.toLocaleString() + " have joined!",
|
||||||
barClass: "progress", textClass: "soFarText" },
|
barClass: "progress", textClass: "soFarText" },
|
||||||
{ value:
|
{ value: needProgress,
|
||||||
((noCommaMatchFinalGoal - noCommaSiteMiddleGoal) / noCommaSiteFinalGoal) * 100,
|
text: leftOver.toLocaleString() + " more needed",
|
||||||
text: leftOver.toLocaleString() + " more needed to save license compliance work.",
|
|
||||||
barClass: "final-goal", textClass: "goalText" },
|
barClass: "final-goal", textClass: "goalText" },
|
||||||
{ value: 100,
|
{ value: 100,
|
||||||
text: siteMatchCount + " matched!",
|
text: noCommaSiteMatchCount.toLocaleString() + " matched!",
|
||||||
barClass: "progress", textClass: "soFarText" },
|
barClass: "progress", textClass: "soFarText" },
|
||||||
]});
|
]});
|
||||||
} else {
|
} else {
|
||||||
$('#siteprogressbar').
|
$('#siteprogressbar').
|
||||||
|
|
Loading…
Reference in a new issue