0 2 0
Brett Smith (brett) - 12 months ago 2019-11-22 14:46:07
brett@sfconservancy.org
base: Break out individual local context variables.
2 files changed with 19 insertions and 14 deletions:
↑ Collapse Diff ↑
...
 
@@ -20,8 +20,9 @@ def fundgoal_lookup(fundraiser_sought):
20 20
 

	
21 21
 
def sitefundraiser(request):
22 22
 
    return {
23
 
        'datetime_now': DateTime.now(UTC),
23 24
 
        'sitefundgoal': fundgoal_lookup(SITE_FUNDGOAL),
24
 
        'sitefundgoal_timeleft': FUNDGOAL_ENDTIMES[SITE_FUNDGOAL] - DateTime.now(UTC),
25
 
        'sitefundgoal_endtime': FUNDGOAL_ENDTIMES[SITE_FUNDGOAL],
25 26
 
    }
26 27
 

	
27 28
 
if conservancy.settings.FORCE_CANONICAL_HOSTNAME:
...
 
@@ -45,32 +45,36 @@
45 45
 
    </div>
46 46
 

	
47 47
 
{% comment %}
48
 
FUNDRAISER VARIABLES AND CONSTANTS GUIDE
48
 
# FUNDRAISER VARIABLES AND CONSTANTS GUIDE
49 49
 

	
50
 
sitefundgoal attributes:
50
 
## From Local Context
51 51
 

	
52
 
fundraiser_goal_amount: The amount being matched
53
 
fundraiser_so_far_amount: The amount contributed so far
54
 
fundraiser_donation_count: The number of people who have contributed so far
55
 
fundraiser_donation_count_disclose_threshold: Not used
52
 
* datetime_now: Current DateTime in UTC
53
 
* sitefundgoal: The current FundraisingGoal. Attributes:
54
 
  * fundraiser_goal_amount: The amount being matched
55
 
  * fundraiser_so_far_amount: The amount contributed so far
56
 
  * fundraiser_donation_count: The number of people who have contributed so far
57
 
  * fundraiser_donation_count_disclose_threshold: Not used
58
 
* sitefundgoal_endtime: DateTime when sitefundgoal ends.
56 59
 

	
57
 
Local convenience variables:
60
 
## Local convenience variables
58 61
 

	
59
 
this_match_goal: The amount being matched
60
 
this_match_so_far: The amount contributed so far
61
 
this_match_remaining: this_match_goal - this_match_so_far
62
 
* sitefundgoal_timeleft: TimeDelta for how much time remains in the current fundraiser
63
 
* this_match_goal: The amount being matched
64
 
* this_match_so_far: The amount contributed so far
65
 
* this_match_remaining: this_match_goal - this_match_so_far
62 66
 

	
63 67
 
{% endcomment %}
64 68
 

	
65 69
 
{% comment %}
66 70
 
{% if sitefundgoal %}
67 71
 
{% with this_match_goal=sitefundgoal.fundraiser_goal_amount this_match_so_far=sitefundgoal.fundraiser_so_far_amount %}
68
 
{% with this_match_remaining=this_match_goal|subtract:this_match_so_far %}
72
 
{% with this_match_remaining=this_match_goal|subtract:this_match_so_far sitefundgoal_timeleft=sitefundgoal_endtime|subtract:datetime_now %}
69 73
 
    <div class="fundraiser-top-text">
70 74
 
      <p>
71 75
 
        {% if this_match_remaining <= 0 %}
72
 
        Thanks to {{ sitegoal.fundraiser_donation_count|intcomma }} Supporters we earned our full match!  Help us go further to stand up for software
73
 
        freedom &mdash; <a href="/supporter">sign up now</a>!
76
 
          Thanks to {{ sitegoal.fundraiser_donation_count|intcomma }} Supporters we earned our full match!
77
 
          Help us go further to stand up for software freedom &mdash; <a href="/supporter">sign up now</a>!
74 78
 
        {% else %}
75 79
 
          {% if sitefundgoal_timeleft.total_seconds <= 0 %}
76 80
 
            The
0 comments (0 inline, 0 general)