Commit graph

54 commits

Author SHA1 Message Date
2ba369aa5c Supporter: js: fade out “Expand All” anchor when all sections expand
The expandable sections can be expanded either one-by-one, or with
the “Expand All” button.  Add a counter for each expandable
section (which requires their div's to have 'id' attributes, lest
they be counted in the '__global' section of expandables).

The __global counter will work as advertised if you have no 'id'
attributes on any of your 'expandable-section'-classed div's, but if
you mix a __global without an id with ones that *do* have an id, it's
likely this particular code won't work for that.

Finally, add some documentation which is probably over-documenting
for someone who knows Javascript and jQuery well, but it took me a
while to figure out this code so I felt throwing some notes in there
might be helpful.
2020-11-26 09:21:44 -08:00
c2d41ca6fd Remove active class addition; don't remove data attr, only expand a 2020-11-25 19:42:57 -08:00
6b649e2f48 Supporter page: Support a “Expand All” link for collapsible sections
I wrap the entire section that has material that can be expanded in a
div with class `expandable-section`.  Once doing so, if you provide an
anchor with the class of `expander`, that anchor will be created with
text in the `data-expand-link-text` attribute.

I've also added some CSS to make the link look a certain way, for
good measure.
2020-11-25 19:27:53 -08:00
Brett Smith
fb6164926f supporters: Dynamically construct "Read more" links in JS.
This provides better presentation to people without JavaScript,
and makes it easier to author the HTML.
2020-11-25 13:47:40 -05:00
Brett Smith
8ca60f8b07 js: Bugfix handling the "no window.location.hash" case. 2020-11-25 11:43:57 -05:00
Brett Smith
e397501bfa supporter: Collapse individual appeal sections. 2020-11-25 11:32:07 -05:00
Brett Smith
e8ec7a33fb js: Code simplification. 2020-11-25 10:45:38 -05:00
Brett Smith
0add4633c1 base_conservancy: Activate progressbar for new match. 2017-11-27 13:08:21 -05:00
Brett Smith
7202787092 supporter: Reorganize form post-input notes.
This makes it easier to keep baseline alignment between labels and their
respective inputs.  Declaring `margin-left: 51%;` for the post-input notes
is not exactly what we want, but it's much closer and less troublesome than
dealing with the vertical alignment of labels otherwise.
2017-01-09 16:56:42 -05:00
Brett Smith
cb5b5ec23f supporter: Refactor amount-checking JavaScript.
* Separate out amount-parsing and reacting into separate events.  This sets
  the stage for other elements to react to the custom
  'conservancy:newamount' event.
* Set up events in the context of each supporter form, with closures.  This
  lets us avoid weird CSS selector gymnastics in the event, and instead
  drill down from the form to find the elements we need.

There are no functional changes in this code, barring bugs.
2017-01-08 18:23:51 -05:00
Brett Smith
ba0df40639 supporter: Improve amount validation JavaScript.
* Check validity on page load and store it in a data attribute so we can
  change validity state more accurately.
* Clear invalid state on any change.
2017-01-01 16:03:03 -05:00
Brett Smith
9d855fda08 supporter: Improve shirt selection JavaScript.
* Add an animation for state changes.
* Set the start state by triggering the event on the selection at page load.
  Firefox at least remembers the selected button on page load.  This avoids
  a situation where the user says they want a shirt, reload, and now the
  size selection is invisible because we used to hide that unconditionally.
2017-01-01 15:28:33 -05:00
Brett Smith
8605b65783 supporter: Move more presentation rules to CSS.
This commit keeps the presentation basically the same, it just moves
presentation rules out of HTML and into CSS.  It's not pixel-perfect but
pretty close.
2017-01-01 13:53:41 -05:00
Brett Smith
19e744788b supporter: Only render the Annual form for upgraders.
This lets us do more with HTML and less with JavaScript, which is always
nice.
2017-01-01 10:53:58 -05:00
Brett Smith
78c474caac supporter: Fix redundant annual/monthly/renewal ids. 2017-01-01 10:24:34 -05:00
Brett Smith
6392ae3a43 supporter: Fix redundant amount, error ids. 2017-01-01 10:24:34 -05:00
Brett Smith
7842ca6c57 supporter: Fix redundant no_shipping id. 2016-12-31 16:22:52 -05:00
Brett Smith
619bc033bc js: Render <video> inner HTML when no source is supported.
The HTML inside <video> is meant to be rendered by browsers that don't
support the tag at all.  You have to respond to the JavaScript error event
to deal with browsers that support video, but no available source.  See
<https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML5_audio_and_video#Showing_fallback_content_when_no_source_could_be_decoded>.
2016-12-31 15:19:59 -05:00
Brett Smith
034a60be9b js: Split whole-site JS from Supporter-specific JS. 2016-12-31 14:46:10 -05:00
Brett Smith
492de3eab3 js: Rewrite #renew links to the Supporter page.
#renewal is the correct hash to use.
2016-12-29 10:33:22 -05:00
Brett Smith
9822895971 supporter: Fix JS syntax to check donation upgrade amount. 2016-12-02 15:26:36 -05:00
Brett Smith
6fe13959a3 supporter: Support donors upgrading to supporters.
With a valid URL, a past donor can upgrade to a supporter by donating
the rest of the amount.  Django validates the data and, if it passes,
puts it in the form.  The JavaScript does most of the work from there.
2016-12-02 12:50:21 -05:00
Brett Smith
d28ffd68ca supporter: HTML5 improvements to form.
* Use "number" type for a better prompt.
* Use new standard "min" attribute for richer validation.
2016-12-02 12:35:19 -05:00
Brett Smith
4afce1eadc appeal: Fix object structure passed into $().multiprogressbar. 2016-12-02 10:13:25 -05:00
Brett Smith
2c5a5f3a95 appeal: Fix jQuery chaining that didn't work. 2016-12-02 10:11:21 -05:00
Brett Smith
6908c135f2 appeal: Progress bar emphasizes current match program. 2016-12-02 10:09:12 -05:00
Brett Smith
1637a36dfe js: Fix math again.
I misunderstood how multiprogressbar works.  Values aren't expected to
progressively grow larger; it takes care of the summing itself.
2016-11-29 13:45:44 -05:00
Brett Smith
52bcf1152a js: Set default noCommaSiteMiddleGoal. 2016-11-29 13:29:12 -05:00
Brett Smith
05290a6352 js: Fix needProgress math. 2016-11-29 13:25:53 -05:00
Brett Smith
8cb1f3f685 js: Use three-part progressbar when no middle goal defined.
Since our current fundraiser doesn't have a "middle goal," this makes
it a little easier to maintain the template and do the math.
2016-11-29 13:13:40 -05:00
Brett Smith
ec26bfc846 supporter-page.js: Add my copyright. 2016-09-09 15:39:21 -04:00
Brett Smith
ab29d45639 Supporter page: Try #2 for scroll to type selection after window ready.
* Trigger on the "load" event rather than "ready".
* Install the handler outside document's "ready" handler so it should
  take effect more reliably.
2016-09-09 15:16:46 -04:00
Brett Smith
fa6a61ed9b Supporter page: Scroll to type selection after window ready. 2016-09-09 14:51:11 -04:00
Brett Smith
9d30d7431a Supporter page: Make supporter type selections act like tabs.
* Scroll to the type selection when the visitor follows a link to a
  specific type.
* Don't scroll the page when the user changes their selection.
2016-09-09 14:35:15 -04:00
Brett Smith
c2ee1c761d Supporter page: Remove debug log. 2016-09-09 12:11:29 -04:00
Brett Smith
86ef51db5d Supporter page: Refactor JavaScript.
This isn't intended to have any functional change, it's just DRYing up
the code to simplify functional changes later.
2016-09-09 12:10:41 -04:00
Bradley M. Kuhn
15ee2b6edd Update punctuation. 2016-02-23 19:46:59 -08:00
Bradley M. Kuhn
cd15ed755b moreCount variable no longer used. 2016-02-23 19:45:50 -08:00
Bradley M. Kuhn
e260280ee1 Fix math error. 2016-02-23 19:45:16 -08:00
Bradley M. Kuhn
99ff4771a1 Change bar to show totals in a different way.
The achieved! text is removed, to just show the total Supporters, and
the middle part is how many more we need right now.
2016-02-23 19:21:22 -08:00
Bradley M. Kuhn
3fe4a5bcbb Reduce ! in various site-wide fundraising texts.
Surprisingly, given her predilection for exclamation points:

  <karen> yeah... believe it or not, I'd rather not have two exclamation points
          in the 750 achieved!  [20:30]

  <karen> and I would also delete the exclamation point after " enforcement
          efforts!" in the text above it  [20:31]

So this change is made on her behalf.
2016-01-18 20:32:12 -08:00
Bradley M. Kuhn
d628fa8fb7 Revert previous incorrect change. 2016-01-18 20:25:17 -08:00
Bradley M. Kuhn
c6af56f2a6 Unclear what this should be, testing this value. 2016-01-18 20:22:17 -08:00
Bradley M. Kuhn
9813a0795f When we're at the middle goal, drop it immediately. 2016-01-18 20:18:49 -08:00
Bradley M. Kuhn
cffc81b5d8 Prepare for Supporters beyond 750.
After the next import, we'll have more than 750 supporters.  This change
not only handles that fact, but adds sufficient Javascript and Django
templating to handle the case if the Supporter count for any reason
drops below 750 again.
2016-01-18 19:50:08 -08:00
Bradley M. Kuhn
822b9b1fcf Add title to this text.
Most browsers popup the title= attribute on mouse-over.
2015-12-24 14:21:47 -08:00
Bradley M. Kuhn
566324fbcb One of the hide's was missing. 2015-12-21 09:29:21 -08:00
Bradley M. Kuhn
f1c924b07e Create renewal option on form.
This adds a renewal option to the form.
2015-12-21 09:25:04 -08:00
Bradley M. Kuhn
963c023eab site-wide supporter count fundraiser.
Using the jQuery UI multiprogress bar added earlier, this change allows
display of the of the progress bar on every page.
2015-11-30 19:19:46 -08:00
Bradley M. Kuhn
61ecfd8341 Move supporter-page.js into js directory. 2015-11-30 19:19:46 -08:00