base: Break out individual local context variables.
This commit is contained in:
parent
fc9b10142f
commit
67e64d3a6c
2 changed files with 19 additions and 14 deletions
|
@ -20,8 +20,9 @@ def fundgoal_lookup(fundraiser_sought):
|
||||||
|
|
||||||
def sitefundraiser(request):
|
def sitefundraiser(request):
|
||||||
return {
|
return {
|
||||||
|
'datetime_now': DateTime.now(UTC),
|
||||||
'sitefundgoal': fundgoal_lookup(SITE_FUNDGOAL),
|
'sitefundgoal': fundgoal_lookup(SITE_FUNDGOAL),
|
||||||
'sitefundgoal_timeleft': FUNDGOAL_ENDTIMES[SITE_FUNDGOAL] - DateTime.now(UTC),
|
'sitefundgoal_endtime': FUNDGOAL_ENDTIMES[SITE_FUNDGOAL],
|
||||||
}
|
}
|
||||||
|
|
||||||
if conservancy.settings.FORCE_CANONICAL_HOSTNAME:
|
if conservancy.settings.FORCE_CANONICAL_HOSTNAME:
|
||||||
|
|
|
@ -45,32 +45,36 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% comment %}
|
{% comment %}
|
||||||
FUNDRAISER VARIABLES AND CONSTANTS GUIDE
|
# FUNDRAISER VARIABLES AND CONSTANTS GUIDE
|
||||||
|
|
||||||
sitefundgoal attributes:
|
## From Local Context
|
||||||
|
|
||||||
fundraiser_goal_amount: The amount being matched
|
* datetime_now: Current DateTime in UTC
|
||||||
fundraiser_so_far_amount: The amount contributed so far
|
* sitefundgoal: The current FundraisingGoal. Attributes:
|
||||||
fundraiser_donation_count: The number of people who have contributed so far
|
* fundraiser_goal_amount: The amount being matched
|
||||||
fundraiser_donation_count_disclose_threshold: Not used
|
* fundraiser_so_far_amount: The amount contributed so far
|
||||||
|
* fundraiser_donation_count: The number of people who have contributed so far
|
||||||
|
* fundraiser_donation_count_disclose_threshold: Not used
|
||||||
|
* sitefundgoal_endtime: DateTime when sitefundgoal ends.
|
||||||
|
|
||||||
Local convenience variables:
|
## Local convenience variables
|
||||||
|
|
||||||
this_match_goal: The amount being matched
|
* sitefundgoal_timeleft: TimeDelta for how much time remains in the current fundraiser
|
||||||
this_match_so_far: The amount contributed so far
|
* this_match_goal: The amount being matched
|
||||||
this_match_remaining: this_match_goal - this_match_so_far
|
* this_match_so_far: The amount contributed so far
|
||||||
|
* this_match_remaining: this_match_goal - this_match_so_far
|
||||||
|
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% comment %}
|
{% comment %}
|
||||||
{% if sitefundgoal %}
|
{% if sitefundgoal %}
|
||||||
{% with this_match_goal=sitefundgoal.fundraiser_goal_amount this_match_so_far=sitefundgoal.fundraiser_so_far_amount %}
|
{% with this_match_goal=sitefundgoal.fundraiser_goal_amount this_match_so_far=sitefundgoal.fundraiser_so_far_amount %}
|
||||||
{% with this_match_remaining=this_match_goal|subtract:this_match_so_far %}
|
{% with this_match_remaining=this_match_goal|subtract:this_match_so_far sitefundgoal_timeleft=sitefundgoal_endtime|subtract:datetime_now %}
|
||||||
<div class="fundraiser-top-text">
|
<div class="fundraiser-top-text">
|
||||||
<p>
|
<p>
|
||||||
{% if this_match_remaining <= 0 %}
|
{% if this_match_remaining <= 0 %}
|
||||||
Thanks to {{ sitegoal.fundraiser_donation_count|intcomma }} Supporters we earned our full match! Help us go further to stand up for software
|
Thanks to {{ sitegoal.fundraiser_donation_count|intcomma }} Supporters we earned our full match!
|
||||||
freedom — <a href="/supporter">sign up now</a>!
|
Help us go further to stand up for software freedom — <a href="/supporter">sign up now</a>!
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if sitefundgoal_timeleft.total_seconds <= 0 %}
|
{% if sitefundgoal_timeleft.total_seconds <= 0 %}
|
||||||
The
|
The
|
||||||
|
|
Loading…
Reference in a new issue