From e78609171dfa443744044c310d5b3b9de1ecfa1e Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Thu, 26 Mar 2015 23:33:52 -0700 Subject: [PATCH] continue work on the param-based funnel --- app.js | 5 +- controllers/nonprofits.js | 48 +++++++++++--- public/css/main.less | 5 +- .../are-you-with-a-registered-nonprofit.jade | 2 +- .../how-can-free-code-camp-help-you.jade | 64 ++++++++----------- views/nonprofits/in-exchange-we-ask.jade | 2 +- views/nonprofits/tell-us-your-name.jade | 11 ++-- 7 files changed, 80 insertions(+), 57 deletions(-) diff --git a/app.js b/app.js index 65c8218c65..83d758bb10 100644 --- a/app.js +++ b/app.js @@ -277,16 +277,17 @@ app.get('/nonprofits', contactController.getNonprofitsForm); app.post('/nonprofits', contactController.postNonprofitsForm); app.get('/nonprofits/home', nonprofitController.nonprofitsHome); app.get('/nonprofits/are-you-with-a-registered-nonprofit', nonprofitController.areYouWithARegisteredNonprofit); -app.get('/nonprofits/how-can-free-code-camp-help-you', nonprofitController.howCanFreeCodeCampHelpYou); app.get('/nonprofits/are-there-people-that-are-already-benefiting-from-your-services', nonprofitController.areTherePeopleThatAreAlreadyBenefitingFromYourServices); app.get('/nonprofits/in-exchange-we-ask', nonprofitController.inExchangeWeAsk); app.get('/nonprofits/ok-with-javascript', nonprofitController.okWithJavaScript); -app.get('/nonprofits/other-solutions', nonprofitController.otherSolutions); +app.get('/nonprofits/how-can-free-code-camp-help-you', nonprofitController.howCanFreeCodeCampHelpYou); +app.post('/nonprofits/how-can-free-code-camp-help-you', nonprofitController.howCanFreeCodeCampHelpYouPost); app.get('/nonprofits/what-does-your-nonprofit-do', nonprofitController.whatDoesYourNonprofitDo); app.get('/nonprofits/link-us-to-your-website', nonprofitController.linkUsToYourWebsite); app.get('/nonprofits/tell-us-your-name', nonprofitController.tellUsYourName); app.get('/nonprofits/tell-us-your-email', nonprofitController.tellUsYourEmail); app.get('/nonprofits/your-nonprofit-project-application-has-been-submitted', nonprofitController.yourNonprofitProjectApplicationHasBeenSubmitted); +app.get('/nonprofits/other-solutions', nonprofitController.otherSolutions); app.get( '/done-with-first-100-hours', diff --git a/controllers/nonprofits.js b/controllers/nonprofits.js index 144c5258ef..1b0b745b1d 100644 --- a/controllers/nonprofits.js +++ b/controllers/nonprofits.js @@ -27,35 +27,47 @@ exports.areYouWithARegisteredNonprofit = function(req, res) { }); }; -exports.howCanFreeCodeCampHelpYou = function(req, res) { - res.render('nonprofits/how-can-free-code-camp-help-you', { - title: 'Are you with a with a registered nonprofit', - step: 2 - }); -}; - - exports.areTherePeopleThatAreAlreadyBenefitingFromYourServices = function(req, res) { res.render('nonprofits/are-there-people-that-are-already-benefiting-from-your-services', { title: 'Are there people already benefiting from your services', - step: 3 + step: 2 }); }; exports.okWithJavaScript = function(req, res) { res.render('nonprofits/ok-with-javascript', { title: 'Are you OK with us using JavaScript', - step: 4 + step: 3 }); }; exports.inExchangeWeAsk = function(req, res) { res.render('nonprofits/in-exchange-we-ask', { title: 'In exchange we ask that you ...', + step: 4 + }); +}; + +exports.howCanFreeCodeCampHelpYou = function(req, res) { + res.render('nonprofits/how-can-free-code-camp-help-you', { + title: 'Are you with a with a registered nonprofit', step: 5 }); }; +exports.howCanFreeCodeCampHelpYouPost = function(req, res) { + var queryString = ''; + if (req.body.websites) { queryString += 'websites&'} + if (req.body.websites) { queryString += 'websites&'} + if (req.body.websites) { queryString += 'websites&'} + if (req.body.websites) { queryString += 'websites&'} + if (req.body.websites) { queryString += 'websites&'} + if (req.body.websites) { queryString += 'websites&'} + if (req.body.websites) { queryString += 'websites&'} + if (req.body.websites) { queryString += 'websites&'} + res.redirect('/nonprofits/tell-us-your-name?' + encodeURIComponent(queryString)); +}; + exports.whatDoesYourNonprofitDo = function(req, res) { res.render('nonprofits/what-does-your-nonprofit-do', { title: 'What does your nonprofit do?', @@ -63,6 +75,10 @@ exports.whatDoesYourNonprofitDo = function(req, res) { }); }; +exports.whatDoesYourNonprofitDoPost = function(req, res) { + res.redirect('nonprofits/link-us-to-your-website?' + req.params); +}; + exports.linkUsToYourWebsite = function(req, res) { res.render('nonprofits/link-us-to-your-website', { title: 'Link us to your website', @@ -70,6 +86,10 @@ exports.linkUsToYourWebsite = function(req, res) { }); }; +exports.linkUsToYourWebsitePost = function(req, res) { + res.redirect('nonprofits/tell-us-your-email?' + req.params); +}; + exports.tellUsYourEmail = function(req, res) { res.render('nonprofits/tell-us-your-email', { title: 'Tell us your name', @@ -77,6 +97,10 @@ exports.tellUsYourEmail = function(req, res) { }); }; +exports.tellUsYourEmailPost = function(req, res) { + res.redirect('nonprofits/tell-us-your-name?' + req.params); +}; + exports.tellUsYourName = function(req, res) { res.render('nonprofits/tell-us-your-name', { title: 'Tell us your name', @@ -84,6 +108,10 @@ exports.tellUsYourName = function(req, res) { }); }; +exports.tellUsYourNamePost = function(req, res) { +}; + + exports.yourNonprofitProjectApplicationHasBeenSubmitted = function(req, res) { res.render('nonprofits/your-nonprofit-project-application-has-been-submitted', { title: 'Your Nonprofit Project application has been submitted!' diff --git a/public/css/main.less b/public/css/main.less index 3e8267ed57..ad76627718 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -880,9 +880,10 @@ iframe.iphone { background-color: #EEEEEE; } -.gray-text { - color: gray; +.checkbox-table label { + margin-left: 10px; } + //uncomment this to see the dimensions of all elements outlined in red //* { // border-color: red; diff --git a/views/nonprofits/are-you-with-a-registered-nonprofit.jade b/views/nonprofits/are-you-with-a-registered-nonprofit.jade index c901d7dbbb..4dc9a6e639 100644 --- a/views/nonprofits/are-you-with-a-registered-nonprofit.jade +++ b/views/nonprofits/are-you-with-a-registered-nonprofit.jade @@ -7,6 +7,6 @@ block content .spacer .row .col-xs-6 - a.btn.btn-primary.btn-big.btn-block(href='/nonprofits/how-can-free-code-camp-help-you') Yes + a.btn.btn-primary.btn-big.btn-block(href='/nonprofits/are-there-people-that-are-already-benefiting-from-your-services') Yes .col-xs-6 a.btn.btn-warning.btn-big.btn-block(href='/nonprofits/other-solutions') No \ No newline at end of file diff --git a/views/nonprofits/how-can-free-code-camp-help-you.jade b/views/nonprofits/how-can-free-code-camp-help-you.jade index 4c0dab17b4..5f2c95f4c1 100644 --- a/views/nonprofits/how-can-free-code-camp-help-you.jade +++ b/views/nonprofits/how-can-free-code-camp-help-you.jade @@ -4,39 +4,31 @@ block content h1.hug-top Nonprofit Sign Up include ../partials/nonprofit-application-progress-bar h2 How can Free Code Camp help you? - .spacer - .row.text-center.negative-35 - .col-xs-12.col-sm-12.col-md-3 - .landing-skill-icon.ion-android-globe - label.black-text.nonprofit-help-select-text-height Websites - input#websites-help.checkbox(type='checkbox') - .col-xs-12.col-sm-12.col-md-3 - .landing-skill-icon.ion-card - h2.black-text.nonprofit-help-select-text-height Donation Systems - input#websites-help.checkbox(type='checkbox') - .col-xs-12.col-sm-12.col-md-3 - .landing-skill-icon.ion-android-calendar - h2.black-text.nonprofit-help-select-text-height Volunteer Systems - input#websites-help.inline.checkbox(type='checkbox') - .col-xs-12.col-sm-12.col-md-3 - .landing-skill-icon.ion-ios-box - h2.black-text.nonprofit-help-select-text-height Inventory Systems - input#websites-help.inline.checkbox(type='checkbox') - .col-xs-12.col-sm-12.col-md-3 - .landing-skill-icon.ion-university - h2.black-text.nonprofit-help-select-text-height E-learning Platforms - input#websites-help.inline.checkbox(type='checkbox') - .col-xs-12.col-sm-12.col-md-3 - .landing-skill-icon.ion-ios-list - h2.black-text.nonprofit-help-select-text-height Web Forms - input#websites-help.inline.checkbox(type='checkbox') - .col-xs-12.col-sm-12.col-md-3 - .landing-skill-icon.ion-ios-people - h2.black-text.nonprofit-help-select-text-height Community Tools - input#websites-help.inline.checkbox(type='checkbox') - .col-xs-12.col-sm-12.col-md-3 - .landing-skill-icon.ion-settings - h2.black-text.nonprofit-help-select-text-height ...and other tools - input#websites-help.inline.checkbox(type='checkbox') - .spacer - a.btn.btn-primary.btn-big.btn-block(href='/nonprofits/are-there-people-that-are-already-benefiting-from-your-services') I've selected all that apply and am ready to move on \ No newline at end of file + form.text-left.form-inline(role='form', method='POST', action="/nonprofits/how-can-free-code-camp-help-you/") + input(type='hidden', name='_csrf', value=_csrf) + h3.col-xs-12.col-sm-offset-5.checkbox-table + .col-xs-12 + input.checkbox(type='checkbox', name='websites') + label.ion-android-globe   Websites + .col-xs-12 + input.checkbox(type='checkbox', name='donation-systems') + label.ion-card   Donation Systems + .col-xs-12 + input.checkbox(type='checkbox', name='volunteer-systems') + label.ion-android-calendar   Volunteer Systems + .col-xs-12 + input.checkbox(type='checkbox', name='inventory-systems') + label.ion-ios-box   Inventory Systems + .col-xs-12 + input.checkbox(type='checkbox', name='e-learning-platforms') + label.ion-university   E-learning Platforms + .col-xs-12 + input.checkbox(type='checkbox', name='web-forms') + label.ion-ios-list   Web Forms + .col-xs-12 + input.checkbox(type='checkbox', name='community-tools') + label.ion-ios-people   Community Tools + .col-xs-12 + input.checkbox(type='checkbox', name='other-tools') + label.ion-settings   Other tools + button.btn.btn-primary.btn-big.btn-block(type='submit') I've selected all that apply and am ready to move on \ No newline at end of file diff --git a/views/nonprofits/in-exchange-we-ask.jade b/views/nonprofits/in-exchange-we-ask.jade index beb4b20da5..e6b02c0877 100644 --- a/views/nonprofits/in-exchange-we-ask.jade +++ b/views/nonprofits/in-exchange-we-ask.jade @@ -12,6 +12,6 @@ block content .spacer .row .col-xs-6 - a.btn.btn-primary.btn-big.btn-block(href='/nonprofits/what-does-your-nonprofit-do') Sounds good! + a.btn.btn-primary.btn-big.btn-block(href='/nonprofits/how-can-free-code-camp-help-you') Sounds good! .col-xs-6 a.btn.btn-warning.btn-big.btn-block(href='/nonprofits/other-solutions') This might not be for us. \ No newline at end of file diff --git a/views/nonprofits/tell-us-your-name.jade b/views/nonprofits/tell-us-your-name.jade index a440d89247..fe0d063e61 100644 --- a/views/nonprofits/tell-us-your-name.jade +++ b/views/nonprofits/tell-us-your-name.jade @@ -5,8 +5,9 @@ block content include ../partials/nonprofit-application-progress-bar h2 Please tell us your name .spacer - .formgroup - .input-group - input.form-control.big-text-field.field-responsive(type='text', maxlength='140', autofocus='') - span.input-group-btn - button.btn.btn-big.btn-primary.btn-responsive(href='/nonprofits/tell-us-your-email') Submit \ No newline at end of file + form(role='form', action="/nonprofits/tell-us-your-name-post", method='POST', novalidate='novalidate', name='nonprofitForm') + .formgroup + .input-group + input.form-control.big-text-field.field-responsive(type='text', maxlength='140', autofocus='') + span.input-group-btn + button.btn.btn-big.btn-primary.btn-responsive Submit \ No newline at end of file