Skip to content

Commit

Permalink
Clean up onboarding.js
Browse files Browse the repository at this point in the history
  • Loading branch information
basta-stripe committed Oct 13, 2017
1 parent 2384083 commit f25d961
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions server/public/scripts/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ document.body.addEventListener('change', function(e) {
if (e.target.name !== 'pilot-type') {
return;
}
// Show the correct header for legal entity information.
document.querySelector('.type-header.is-visible').classList.toggle('is-visible');
document.querySelector(`.type-header.${e.target.value}-info`).classList.add('is-visible');

Array.prototype.slice.call(document.querySelectorAll('.pilot-info')).forEach(function(elem) {
elem.classList.remove('is-visible');
});
Array.prototype.slice.call(document.querySelectorAll(`.pilot-info.${e.target.value}-type`)).forEach(function(elem) {
elem.classList.add('is-visible');
// Show any fields that apply to the new pilot type.
Array.prototype.slice.call(
document.querySelectorAll('.pilot-info')
).forEach(function(elem) {
elem.classList.toggle(
'is-visible',
elem.classList.contains(`${e.target.value}-type`)
);
});
});

0 comments on commit f25d961

Please sign in to comment.