Changeset - 19e744788b7f
[Not reviewed]
0 2 0
Brett Smith (brett) - 7 years ago 2017-01-01 15:53:58
brett@sfconservancy.org
supporter: Only render the Annual form for upgraders.

This lets us do more with HTML and less with JavaScript, which is always
nice.
2 files changed with 19 insertions and 16 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/js/supporter-page.js
Show inline comments
...
 
@@ -16,13 +16,13 @@ var amountIsValid = function(amountInput) {
 
    var min = parseFloat(amountInput.min);
 
    /* Is the value is a valid float, it will stringify back to itself. */
 
    return (String(value) === amountInput.value) && (value >= min);
 
}
 

	
 
var supportTypeSelector = function(supportTypeHash) {
 
    return $(".supporter-type-selector a[href=" + supportTypeHash + "]");
 
    return $(supportTypeHash + "Selector");
 
};
 

	
 
var $window = $(window);
 

	
 
$window.load(function() {
 
    /* We've sometimes published links that say #renew instead of #renewal.
...
 
@@ -81,15 +81,10 @@ $(document).ready(function() {
 
    $(".supporter-type-selector a").bind("click", selectSupportType);
 

	
 
    var selectSupportTypeFromHash = function() {
 
        return supportTypeSelector(window.location.hash).click();
 
    };
 
    $window.bind("hashchange", selectSupportTypeFromHash);
 
    var $selectorLink = selectSupportTypeFromHash();
 
    if (parseFloat($("#annual form").data('upgradeFromAmount')) > 0) {
 
        supportTypeSelector("#annual").click();
 
        $(".supporter-type-selector").hide();
 
    }
 
    else if ($selectorLink.length === 0) {
 
    if (selectSupportTypeFromHash().length === 0) {
 
        supportTypeSelector("#annual").click();
 
    }
 
});
www/conservancy/templates/supporter/index.html
Show inline comments
...
 
@@ -51,21 +51,29 @@
 
</td></tr></table>
 
</div>
 
<div class="content-with-donate-sidebar">
 
  <h1 class="appeal"><img class="appeal-header" alt="Become a Conservancy Supporter!" src="/img/conservancy-supporter-header.png"/></h1>
 

	
 
  
 
<div class="supporter-type-selector">
 
  <strong>Become a Supporter Now:</strong>   <a id="annualSelector" href="#annual">Annual</a> | <a id="monthlySelector" href="#monthly">Monthly</a> | <a id="renewalSelector" href="#renewal">Annual Renew</a></div>
 

	
 
{% include "supporter/form_partial.html" with form_id="annual" min_amt=minimum_amount partial_amt=partial_amount article="an" only %}
 

	
 
{% include "supporter/form_partial.html" with form_id="monthly" min_amt=10 only %}
 

	
 
<a name="renew" class="hidden"></a>
 
{% include "supporter/form_partial.html" with form_id="renewal" min_amt=120 verb="renew" article="an" supptype="annual" only %}
 
{% if partial_amount > 0 %}
 
  {% include "supporter/form_partial.html" with form_id="annual" min_amt=minimum_amount partial_amt=partial_amount article="an" only %}
 
{% else %}
 
  <div class="supporter-type-selector">
 
    <strong>Become a Supporter Now:</strong>
 
    <a id="annualSelector" href="#annual">Annual</a>
 
    | <a id="monthlySelector" href="#monthly">Monthly</a>
 
    | <a id="renewalSelector" href="#renewal">Annual Renew</a>
 
  </div>
 

	
 
  {% include "supporter/form_partial.html" with form_id="annual" min_amt=120 article="an" only %}
 

	
 
  {% include "supporter/form_partial.html" with form_id="monthly" min_amt=10 only %}
 

	
 
  <a name="renew" class="hidden"></a>
 
  {% include "supporter/form_partial.html" with form_id="renewal" min_amt=120 verb="renew" article="an" supptype="annual" only %}
 
{% endif %}
 

	
 
<span id="form-correction-needed" class="form-error">Please ensure all form data above is correct.</span>
 

	
 
<hr style="clear: both;"/>
 
<h4>Software Freedom needs your help.</h4>
 

	
0 comments (0 inline, 0 general)