Changeset - 0add4633c153
[Not reviewed]
0 3 0
Brett Smith (brett) - 6 years ago 2017-11-27 18:08:21
brett@sfconservancy.org
base_conservancy: Activate progressbar for new match.
3 files changed with 24 insertions and 20 deletions:
0 comments (0 inline, 0 general)
www/conservancy/local_context_processors.py
Show inline comments
...
 
@@ -6,13 +6,13 @@ def fundgoal_lookup(fundraiser_sought):
 
        return FundraisingGoal.objects.get(fundraiser_code_name=fundraiser_sought)
 
    except FundraisingGoal.DoesNotExist:
 
        # we have no object!  do something
 
        return None
 

	
 
def sitefundraiser(request):
 
    return {'sitefundgoal': fundgoal_lookup('supporterrun') }
 
    return {'sitefundgoal': fundgoal_lookup('fy-2018-main-match') }
 

	
 
if conservancy.settings.FORCE_CANONICAL_HOSTNAME:
 
    _HOST_URL_VAR = {'host_url': 'https://' + conservancy.settings.FORCE_CANONICAL_HOSTNAME}
 
    def host_url(request):
 
        return _HOST_URL_VAR
 
else:
www/conservancy/static/js/conservancy.js
Show inline comments
...
 
@@ -26,21 +26,21 @@ $(document).ready(function() {
 
    var noCommaSiteMatchCount = parseInt(siteMatchCount.replace(/,/g, ""));
 
    if (! noCommaSiteMatchCount) {
 
        noCommaSiteMatchCount = "0";
 
    }
 
    var barParts = [{
 
        value: (noCommaSiteMatchCount / noCommaSiteFinalGoal) * 100,
 
        text: noCommaSiteMatchCount.toLocaleString() + " matched!",
 
        text: "$" + noCommaSiteMatchCount.toLocaleString() + " matched!",
 
        barClass: "progress",
 
        textClass: "soFarText",
 
    }];
 
    if (barParts[0].value < 100) {
 
        var matchesLeft = noCommaSiteFinalGoal - noCommaSiteMatchCount;
 
        barParts.push({
 
            value: 100,
 
            text: matchesLeft.toLocaleString() + " to go!",
 
            text: "$" + matchesLeft.toLocaleString() + " to go!",
 
            barClass: "final-goal",
 
            textClass: "goalText",
 
        });
 
    }
 
    $('#siteprogressbar').empty().multiprogressbar({parts: barParts});
 

	
www/conservancy/templates/base_conservancy.html
Show inline comments
...
 
@@ -44,51 +44,55 @@
 

	
 
    </div>
 

	
 
{% comment %}
 
FUNDRAISER VARIABLES AND CONSTANTS GUIDE
 

	
 
fundraiser_goal_amount: The highest number of Supporters we want
 
fundraiser_so_far_amount: The number of Supporters we have
 
fundraiser_donation_count: The "minimum" number of Supporters we want (not currently used)
 
fundraiser_donation_count_disclose_threshold: The number of Supporters that have been matched
 
sitefundgoal attributes:
 

	
 
fundraiser_goal_amount: The amount being matched
 
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
 

	
 
Local convenience variables:
 

	
 
this_match_goal: The amount being matched
 
this_match_so_far: The amount contributed so far
 
this_match_remaining: this_match_goal - this_match_so_far
 

	
 
When we started this match, we had 1076 Supporters matched, so we subtract
 
that from count_disclose_threshold to determine how many happened in the
 
current match.
 
{% endcomment %}
 

	
 
{% comment %}
 
{% with this_match_goal=150 this_match_so_far=sitefundgoal.fundraiser_donation_count_disclose_threshold|subtract:1076 %}
 
{% 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 %}
 
    <div class="fundraiser-top-text">
 
      <em>
 
        {% if this_match_remaining <= 0 %}
 
        Thanks to {{ this_match_goal|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!  Help us go further to stand up for software
 
        freedom &mdash; <a href="/supporter">sign up now</a>!
 
        {% else %}
 
        Let's stand up for software freedom together!
 
        The next {{ this_match_remaining|intcomma }} Supporters who join or
 
        renew by February 28th will be matched by an anonymous donor!  <a href="/supporter/">Join today!</a>
 
        The next ${{ this_match_remaining|floatformat:0|intcomma }} we receive from Supporters and donors will be matched!  <a href="/supporter/">Join today!</a>
 
        {% endif %}
 
      </em>
 
<div id="siteprogressbar">
 
<a href="/supporter">
 
  We've matched
 
  {% if this_match_remaining <= 0 %}
 
  <span id="site-fundraiser-match-count">{{ this_match_goal|intcomma }}</span>
 
  $<span id="site-fundraiser-match-count">{{ this_match_goal|intcomma }}</span>
 
  {% else %}
 
  <span id="site-fundraiser-match-count">{{ this_match_so_far|intcomma }}</span>
 
  $<span id="site-fundraiser-match-count">{{ this_match_so_far|intcomma }}</span>
 
  {% endif %}
 
  Supporters have been matched, out of
 
  <span id="site-fundraiser-final-goal">{{ this_match_goal|intcomma }}</span> possible.
 
  of
 
  $<span id="site-fundraiser-final-goal">{{ this_match_goal|intcomma }}</span>
 
  so far!
 
</a>
 
</div>
 
</div>
 
{% endwith %}
 
{% endwith %}
 
{% endcomment %}
 

	
 
      {% block outercontent %}<div id="mainContent"> {% block content %}{% endblock %}</div>{% endblock %}
 
    <div id="conservancyfooter">
 
      <p>Connect with Conservancy on
 
        <a href="https://mastodon.technology/@conservancy">Mastodon</a>,
 
        <a href="https://twitter.com/conservancy">Twitter</a>,
0 comments (0 inline, 0 general)