Changeset - 19e744788b7f
[Not reviewed]
0 2 0
Brett Smith (brett) - 5 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
...
 
@@ -19,7 +19,7 @@ var amountIsValid = function(amountInput) {
 
}
 

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

	
 
var $window = $(window);
...
 
@@ -84,12 +84,7 @@ $(document).ready(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
...
 
@@ -54,15 +54,23 @@
 
  <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>
 

	
0 comments (0 inline, 0 general)