Widget:PledgeTracker: Difference between revisions

From Nottinghack Wiki
Jump to navigation Jump to search
Initial version
 
forgot the paragraphs
Line 66: Line 66:
         }
         }
       )
       )
       $("Pledges Raised: £" + amountPledged + " / £" + pledgeGoalAmount + " (" + ((amountPledged / pledgeGoalAmount) * 100).toFixed(2) + "%)").appendTo('#pledgeTracker<!--{$pledgeTrackerDivId|escape:'html'}-->');
       $("<p><b>Pledges Raised:</b> £" + amountPledged + " / £" + pledgeGoalAmount + " (" + ((amountPledged / pledgeGoalAmount) * 100).toFixed(2) + "%)</p>").appendTo('#pledgeTracker<!--{$pledgeTrackerDivId|escape:'html'}-->');
       $("Pledges Collected: £" + amountCollected + " / £" + amountPledged + " (" + ((amountCollected / amountPledged) * 100).toFixed(2) + "%)").appendTo('#pledgeTracker<!--{$pledgeTrackerDivId|escape:'html'}-->');
       $("<p><b>Pledges Collected:</b> £" + amountCollected + " / £" + amountPledged + " (" + ((amountCollected / amountPledged) * 100).toFixed(2) + "%)</p>").appendTo('#pledgeTracker<!--{$pledgeTrackerDivId|escape:'html'}-->');
     });
     });
   </script>
   </script>
   <!-- PledgeTracker code ends here -->
   <!-- PledgeTracker code ends here -->
</includeonly>
</includeonly>

Revision as of 00:03, 12 June 2014

This widget tracks the current amount pledged and collected for a pledge drive on a wiki page which makes use of table with specific columns.

Using this widget

You can insert a pledge tracker with the following wiki code:

{{#widget:PledgeTracker|tableIndex=1|pledgeGoal=100|pledgeAmountColumn=2|pledgePaidColumn=3}}

Parameters

tableIndex
The index of the table on the page containing the pledges (1 = the first table). Default: 1
pledgeGoal
The goal amount for the pledge drive. Default: 0
pledgeAmountColumn
The index of the column within the pledges table which contains the pledge amount (1 = the first column). Default: 2
pledgePaidColumn
The index of the column within the table which indicates if the pledge amount has been paid (1 = the first column). If the column contains 'yes' or 'y' (case insensitive) then the pledge amount is considered to have been paid, any other content is considered as not paid. Default: 3

Example

Who Amount Paid? Method Paid
Bob £30 Yes BACS
Alice £50 Yes CASH
Carol £25 No BACS