diff --git a/app.js b/app.js index 878135beb2..07314c65dc 100644 --- a/app.js +++ b/app.js @@ -15,7 +15,7 @@ process.on('uncaughtException', function (err) { }); var express = require('express'), - accepts = require('accepts'), + //accepts = require('accepts'), cookieParser = require('cookie-parser'), compress = require('compression'), session = require('express-session'), @@ -36,10 +36,12 @@ var express = require('express'), * Controllers (route handlers). */ homeController = require('./controllers/home'), - challengesController = require('./controllers/challenges'), resourcesController = require('./controllers/resources'), userController = require('./controllers/user'), contactController = require('./controllers/contact'), + ziplineController = require('./controllers/ziplines'), + basejumpController = require('./controllers/basejumps'), + nonprofitController = require('./controllers/nonprofits'), bonfireController = require('./controllers/bonfire'), coursewareController = require('./controllers/courseware'), @@ -105,7 +107,7 @@ app.use(session({ secret: secrets.sessionSecret, store: new MongoStore({ url: secrets.db, - 'auto_reconnect': true + 'autoReconnect': true }) })); app.use(passport.initialize()); @@ -273,6 +275,18 @@ app.post('/email-signup', userController.postEmailSignup); app.post('/email-signin', userController.postSignin); 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/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/how-can-free-code-camp-help-you', nonprofitController.howCanFreeCodeCampHelpYou); +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', @@ -437,8 +451,6 @@ app.post('/account/password', userController.postUpdatePassword); app.post('/account/delete', userController.postDeleteAccount); app.get('/account/unlink/:provider', userController.getOauthUnlink); app.get('/sitemap.xml', resourcesController.sitemap); - - /** * OAuth sign-in routes. */ diff --git a/controllers/basejumps.js b/controllers/basejumps.js new file mode 100644 index 0000000000..e9687201a6 --- /dev/null +++ b/controllers/basejumps.js @@ -0,0 +1,21 @@ +var async = require('async'), + User = require('../models/User'), + Challenge = require('./../models/Challenge'), + Bonfire = require('./../models/Bonfire'), + Story = require('./../models/Story'), + Comment = require('./../models/Comment'), + resources = require('./resources.json'), + steps = resources.steps, + secrets = require('./../config/secrets'), + moment = require('moment'), + https = require('https'), + debug = require('debug')('freecc:cntr:resources'), + cheerio = require('cheerio'), + request = require('request'), + R = require('ramda'); + +nonprofitHome: function nonprofitHome(req, res) { + res.render('nonprofits/home', { + title: 'A guide to our Nonprofit Projects' + }); +} \ No newline at end of file diff --git a/controllers/nonprofits.js b/controllers/nonprofits.js new file mode 100644 index 0000000000..4ceda4de1e --- /dev/null +++ b/controllers/nonprofits.js @@ -0,0 +1,101 @@ +var async = require('async'), + User = require('../models/User'), + Challenge = require('./../models/Challenge'), + Bonfire = require('./../models/Bonfire'), + Story = require('./../models/Story'), + Comment = require('./../models/Comment'), + resources = require('./resources.json'), + steps = resources.steps, + secrets = require('./../config/secrets'), + moment = require('moment'), + https = require('https'), + debug = require('debug')('freecc:cntr:resources'), + cheerio = require('cheerio'), + request = require('request'), + R = require('ramda'); + +exports.nonprofitsHome = function(req, res) { + res.render('nonprofits/home', { + title: 'A guide to our Nonprofit Projects' + }); +}; + +exports.areYouWithARegisteredNonprofit = function(req, res) { + res.render('nonprofits/are-you-with-a-registered-nonprofit', { + title: 'Are you with a with a registered nonprofit', + step: 1 + }); +}; + +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: 2 + }); +}; + +exports.okWithJavaScript = function(req, res) { + res.render('nonprofits/ok-with-javascript', { + title: 'Are you OK with us using JavaScript', + 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.whatDoesYourNonprofitDo = function(req, res) { + res.render('nonprofits/what-does-your-nonprofit-do', { + existingParams: req.params, + title: 'What does your nonprofit do?', + step: 6 + }); +}; + +exports.linkUsToYourWebsite = function(req, res) { + res.render('nonprofits/link-us-to-your-website', { + title: 'Link us to your website', + step: 7 + }); +}; + +exports.tellUsYourEmail = function(req, res) { + res.render('nonprofits/tell-us-your-email', { + title: 'Tell us your name', + step: 8 + }); +}; + +exports.tellUsYourName = function(req, res) { + res.render('nonprofits/tell-us-your-name', { + title: 'Tell us your name', + step: 9 + }); +}; + +exports.finishApplication = 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!' + }); +}; + +exports.otherSolutions = function(req, res) { + res.render('nonprofits/other-solutions', { + title: 'Here are some other possible solutions for you' + }); +}; diff --git a/controllers/ziplines.js b/controllers/ziplines.js new file mode 100644 index 0000000000..e9687201a6 --- /dev/null +++ b/controllers/ziplines.js @@ -0,0 +1,21 @@ +var async = require('async'), + User = require('../models/User'), + Challenge = require('./../models/Challenge'), + Bonfire = require('./../models/Bonfire'), + Story = require('./../models/Story'), + Comment = require('./../models/Comment'), + resources = require('./resources.json'), + steps = resources.steps, + secrets = require('./../config/secrets'), + moment = require('moment'), + https = require('https'), + debug = require('debug')('freecc:cntr:resources'), + cheerio = require('cheerio'), + request = require('request'), + R = require('ramda'); + +nonprofitHome: function nonprofitHome(req, res) { + res.render('nonprofits/home', { + title: 'A guide to our Nonprofit Projects' + }); +} \ No newline at end of file diff --git a/public/css/main.less b/public/css/main.less index 5b136853e5..ad76627718 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -335,6 +335,10 @@ ul { margin-bottom: -10px; } +.nonprofit-landing { + font-size: 50px; +} + .big-text { font-size: 63px; } @@ -731,6 +735,11 @@ iframe.iphone { } } +.nonprofit-help-select-text-height { + font-size: 40px; + padding-top: 20px; +} + // To adjust right margin, negative values bring the image closer to the edge of the screen .iphone-position { position: absolute; @@ -871,6 +880,10 @@ iframe.iphone { background-color: #EEEEEE; } +.checkbox-table label { + margin-left: 10px; +} + //uncomment this to see the dimensions of all elements outlined in red //* { // border-color: red; diff --git a/public/js/application.js b/public/js/application.js index eeebfa316b..bf07cd484f 100644 --- a/public/js/application.js +++ b/public/js/application.js @@ -16,4 +16,4 @@ //= require lib/jquery-2.1.1.min //= require lib/bootstrap.min //= require lib/moment/moment -//= require main +//= require main \ No newline at end of file diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index da09c0a208..8ea9007701 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -77,7 +77,7 @@ block content span.ion-arrow-up-b | Less information #submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter) - #showAllButton.btn.btn-info.btn-big.btn-block Show all coding challenges + #showAllButton.btn.btn-info.btn-big.btn-block Show all bonfires br form.code .form-group.codeMirrorView diff --git a/views/home.jade b/views/home.jade index 70da30cc7e..cb76c768f1 100644 --- a/views/home.jade +++ b/views/home.jade @@ -25,7 +25,7 @@ block content a.btn.btn-cta.signup-btn(href="/login") Start learning to code (it's free) br br - a.btn.nonprofit-cta.btn-success(href="/nonprofits") I'm with a nonprofit and want help coding something + a.btn.nonprofit-cta.btn-success(href="/nonprofits") Get pro bono help for my nonprofit .big-break h2 Campers you'll hang out with: .row diff --git a/views/nonprofits/are-there-people-that-are-already-benefiting-from-your-services.jade b/views/nonprofits/are-there-people-that-are-already-benefiting-from-your-services.jade new file mode 100644 index 0000000000..5f82c3c82b --- /dev/null +++ b/views/nonprofits/are-there-people-that-are-already-benefiting-from-your-services.jade @@ -0,0 +1,12 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 We build solutions for nonprofits who are already serving a need. Are there people who already benefit from your services? + .spacer + .row + .col-xs-6 + a.btn.btn-primary.btn-big.btn-block(href='/nonprofits/ok-with-javascript') 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/are-you-with-a-registered-nonprofit.jade b/views/nonprofits/are-you-with-a-registered-nonprofit.jade new file mode 100644 index 0000000000..4dc9a6e639 --- /dev/null +++ b/views/nonprofits/are-you-with-a-registered-nonprofit.jade @@ -0,0 +1,12 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 Do you represent a nonprofit organization that is registered with your government? + .spacer + .row + .col-xs-6 + 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/home.jade b/views/nonprofits/home.jade new file mode 100644 index 0000000000..b76a306f25 --- /dev/null +++ b/views/nonprofits/home.jade @@ -0,0 +1,83 @@ +extends ../layout +block content + .jumbotron + .text-center + h2.nonprofit-landing.hug-top We'll code for your nonprofit, pro bono + .big-break + h2 Some of our success stories + .row + .col-xs-12.col-sm-12.col-md-4 + img.img-responsive.testimonial-image.img-center(src="https://s3.amazonaws.com/freecodecamp/testimonial-jen.jpg", alt="@jenthebest's testimonial image") + .testimonial-copy Getting back on track with Free Code Camp and committing to a new career in 2015! + h3 - @jenbestyoga + .col-xs-12.col-sm-12.col-md-4 + img.img-responsive.testimonial-image.img-center(src="https://s3.amazonaws.com/freecodecamp/testimonial-tate.jpg", alt="@TateThurston's testimonial image") + .testimonial-copy Just built my company's website with skills I've learned from Free Code Camp! + h3 - @TateThurston + .col-xs-12.col-sm-12.col-md-4 + img.img-responsive.testimonial-image.img-center(src="https://s3.amazonaws.com/freecodecamp/testimonial-cynthia.jpg", alt="@cynthialanel's testimonial image") + .testimonial-copy I'm currently working through Free Code Camp to improve my JavaScript. The community is very welcoming! + h3 - @cynthialanel + .big-break + a.btn.btn-cta.signup-btn(href="/nonprofits/are-you-with-a-registered-nonprofit") Get pro bono help for my nonprofit + .big-break + h2 Our process + .row + .col-xs-12.col-sm-12.col-md-4 + h3.nowrap Your idea + img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_portfolio.svg.gz', title='Get great references and connections to help you get a job') + p.landing-p You tell us how we can help you. + .col-xs-12.col-sm-12.col-md-4 + h3.nowrap Our team + img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_nonprofits.svg.gz', title='Build a portfolio of apps for nonprofits') + p.landing-p We'll hand pick developers and a project manager. + .col-xs-12.col-sm-12.col-md-4 + h3.nowrap Your solution + img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_connect.svg.gz', title='Help nonprofits') + p.landing-p Together we'll set milestones and complete your project. + .big-break + h2 Solutions we can help you build: + .text-center.negative-35 + .col-xs-12.col-sm-12.col-md-3 + .landing-skill-icon.ion-android-globe + h2.black-text Websites + .col-xs-12.col-sm-12.col-md-3 + .landing-skill-icon.ion-card + h2.black-text Donation Systems + .col-xs-12.col-sm-12.col-md-3 + .landing-skill-icon.ion-android-calendar + h2.black-text Volunteer Systems + .col-xs-12.col-sm-12.col-md-3 + .landing-skill-icon.ion-ios-box + h2.black-text Inventory Systems + .col-xs-12.col-sm-12.col-md-3 + .landing-skill-icon.ion-university + h2.black-text E-learning Platforms + .col-xs-12.col-sm-12.col-md-3 + .landing-skill-icon.ion-ios-list + h2.black-text Web Forms + .col-xs-12.col-sm-12.col-md-3 + .landing-skill-icon.ion-ios-people + h2.black-text Community Tools + .col-xs-12.col-sm-12.col-md-3 + .landing-skill-icon.ion-settings + h2.black-text ...and other tools + br + br + .big-break + h2 Why you should join our community right now: + h3.col-xs-offset-0.col-sm-offset-1 + ul.text-left + li.ion-code   We're thousands of professionals, all learning to code together + li.ion-code   We're building projects for dozens of nonprofits + li.ion-code   Our community is 100% free and open source + li.ion-code   You'll learn Full Stack JavaScript and become a Software Engineer + li.ion-code   You'll work through our focused, interactive courses and tutorials + li.ion-code   You'll learn to code at your own pace, in your browser or on your phone + li.ion-code   You'll become qualified for thousands of jobs currently going unfilled + li.ion-code   You can get help in real time from our community chat rooms and forum + li.ion-code   We all share one common goal: to boost our careers with code + .big-break + a.btn.btn-cta.signup-btn(href="/nonprofits/are-you-with-a-registered-nonprofit") Get pro bono help for my nonprofit + script. + challengeName = 'Home' \ 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 new file mode 100644 index 0000000000..3aeec6490a --- /dev/null +++ b/views/nonprofits/how-can-free-code-camp-help-you.jade @@ -0,0 +1,33 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 How can Free Code Camp help you? + .text-left.form-inline + h3.col-xs-12.col-sm-offset-5.checkbox-table + .col-xs-12 + input.checkbox(type='checkbox', id='websites') + label.ion-android-globe   Websites + .col-xs-12 + input.checkbox(type='checkbox', id='donationSystems') + label.ion-card   Donation Systems + .col-xs-12 + input.checkbox(type='checkbox', id='volunteerSystems') + label.ion-android-calendar   Volunteer Systems + .col-xs-12 + input.checkbox(type='checkbox', id='inventorySystems') + label.ion-ios-box   Inventory Systems + .col-xs-12 + input.checkbox(type='checkbox', id='eLearningPlatforms') + label.ion-university   E-learning Platforms + .col-xs-12 + input.checkbox(type='checkbox', id='webForms') + label.ion-ios-list   Web Forms + .col-xs-12 + input.checkbox(type='checkbox', id='communityTools') + label.ion-ios-people   Community Tools + .col-xs-12 + input.checkbox(type='checkbox', id='otherTools') + label.ion-settings   Other tools + button#next-step.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 new file mode 100644 index 0000000000..e6b02c0877 --- /dev/null +++ b/views/nonprofits/in-exchange-we-ask.jade @@ -0,0 +1,17 @@ +extends ../layout +block content + .jumbotron + h1.hug-top.text-center Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 Great! In exchange for our help, we ask only that you: + h3 + ol + li Appoint one principal stakeholder to serve on behalf of your organization. + li Communicate with our campers on a regular basis, to answer questions and provide them with direction. + li Commit to using the solution that our campers build for your nonprofit. + .spacer + .row + .col-xs-6 + 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/link-us-to-your-website.jade b/views/nonprofits/link-us-to-your-website.jade new file mode 100644 index 0000000000..bdb59455ad --- /dev/null +++ b/views/nonprofits/link-us-to-your-website.jade @@ -0,0 +1,14 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 Link us to the website, blog, or social media page that best represents your organization. + .spacer + form(role='form', method='GET', action="/nonprofits/tell-us-your-email/?" + existingParams) + input(type='hidden', name='_csrf', value=_csrf) + .formgroup + .input-group + input.form-control.big-text-field.field-responsive(type='text', name='link', autocomplete='off', maxlength='500', autofocus='') + span.input-group-btn + button.btn.btn-big.btn-primary.btn-responsive Submit \ No newline at end of file diff --git a/views/nonprofits/ok-with-javascript.jade b/views/nonprofits/ok-with-javascript.jade new file mode 100644 index 0000000000..1835218868 --- /dev/null +++ b/views/nonprofits/ok-with-javascript.jade @@ -0,0 +1,12 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 Our campers are learning to code using modern full stack JavaScript technologies like Node.js. We do not build or maintain Wordpress, Drupal, or other non-JavaScript based frameworks. + .spacer + .row + .col-xs-6 + a.btn.btn-primary.btn-big.btn-block(href='/nonprofits/in-exchange-we-ask') 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/other-solutions.jade b/views/nonprofits/other-solutions.jade new file mode 100644 index 0000000000..b9a19a3b36 --- /dev/null +++ b/views/nonprofits/other-solutions.jade @@ -0,0 +1,5 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Here are some other solutions we recommend + .spacer \ No newline at end of file diff --git a/views/nonprofits/tell-us-your-email.jade b/views/nonprofits/tell-us-your-email.jade new file mode 100644 index 0000000000..3bd8918f6b --- /dev/null +++ b/views/nonprofits/tell-us-your-email.jade @@ -0,0 +1,14 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 Please tell us your email + .spacer + form(role='form', method='GET', novalidate='novalidate', name='nonprofitForm', action="/nonprofits/tell-us-your-name/") + input(type='hidden', name='_csrf', value=_csrf) + .formgroup + .input-group + input.form-control.big-text-field.field-responsive(type='text', name='email', autocomplete='off', maxlength='500', autofocus='') + span.input-group-btn + button.btn.btn-big.btn-primary.btn-responsive Submit \ No newline at end of file diff --git a/views/nonprofits/tell-us-your-name.jade b/views/nonprofits/tell-us-your-name.jade new file mode 100644 index 0000000000..915c0b3258 --- /dev/null +++ b/views/nonprofits/tell-us-your-name.jade @@ -0,0 +1,13 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 Please tell us your name + .spacer + form(role='form', method='POST', novalidate='novalidate', name='nonprofitForm', action="/nonprofits/finish-application/") + .formgroup + .input-group + input.form-control.big-text-field.field-responsive(type='text', name='name', autocomplete='off', maxlength='140', autofocus='') + span.input-group-btn + button.btn.btn-big.btn-primary.btn-responsive Submit \ No newline at end of file diff --git a/views/nonprofits/what-does-your-nonprofit-do.jade b/views/nonprofits/what-does-your-nonprofit-do.jade new file mode 100644 index 0000000000..166cb71418 --- /dev/null +++ b/views/nonprofits/what-does-your-nonprofit-do.jade @@ -0,0 +1,28 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 In 140 characters or less, what does your nonprofit do? For whom? + .spacer + form(role='form', method='GET', action="/nonprofits/link-us-to-your-website/") + input(type='hidden', name='_csrf', value=_csrf) + .formgroup + .input-group + input.form-control.big-text-field.field-responsive#what-does-the-nonprofit-do(type='text', maxlength='140', autofocus='', autocomplete='off', name='mission') + span.input-group-btn + button.btn.btn-big.btn-primary.btn-responsive(href='/nonprofits/link-us-to-your-website') Submit + .text-left + span#what-does-the-nonprofit-do-feedback + + script. + var text_max = 140; + $('#what-does-the-nonprofit-do-feedback').html(text_max + ' characters remaining'); + $('#what-does-the-nonprofit-do').keyup(function (e) { + if (e.which === 13 || e === 13) { + $('#submit-comment-to-comment').click(); + } + var text_length = $('#what-does-the-nonprofit-do').val().length; + var text_remaining = text_max - text_length; + $('#what-does-the-nonprofit-do-feedback').html(text_remaining + ' characters remaining'); + }); \ No newline at end of file diff --git a/views/nonprofits/your-nonprofit-project-application-has-been-submitted.jade b/views/nonprofits/your-nonprofit-project-application-has-been-submitted.jade new file mode 100644 index 0000000000..7190fd14ec --- /dev/null +++ b/views/nonprofits/your-nonprofit-project-application-has-been-submitted.jade @@ -0,0 +1,6 @@ +extends ../layout +block content + .jumbotron.text-center + h1.hug-top Nonprofit Sign Up + include ../partials/nonprofit-application-progress-bar + h2 Thank you for reaching out to us. We’ll get back with you before N of next week. \ No newline at end of file diff --git a/views/partials/nonprofit-application-progress-bar.jade b/views/partials/nonprofit-application-progress-bar.jade new file mode 100644 index 0000000000..440bb67262 --- /dev/null +++ b/views/partials/nonprofit-application-progress-bar.jade @@ -0,0 +1,39 @@ +.spacer +.progress + .progress-bar(role='progressbar', aria-valuenow= (step * 10), aria-valuemin='0', aria-valuemax='100', style="width: #{step * 10}%;") + span.sr-only= step * 10 + | % Complete +h3.gray-text.text-center Step #{step} of 9 + + +script. + $('#story-url').on('keypress', function (e) { + if (e.which === 13 || e === 13) { + $('#preliminary-story-submit').click(); + } + }); + var preliminaryStorySubmit = function preliminaryStorySubmit() { + var storyURL = $('#story-url').val(); + $('#preliminary-story-submit').attr('disabled', 'disabled'); + $.post('/stories/preliminary', + { + data: { + url: storyURL + } + }) + .fail(function (xhr, textStatus, errorThrown) { + $('#preliminary-story-submit').attr('disabled', false); + }) + .done(function (data, textStatus, xhr) { + if (data.alreadyPosted) { + window.location = data.storyURL; + } else { + window.location = '/stories/submit/new-story?url=' + + encodeURIComponent(data.storyURL) + + '&title=' + encodeURIComponent(data.storyTitle) + + '&image=' + encodeURIComponent(data.storyImage) + + '&description=' + encodeURIComponent(data.storyMetaDescription); + } + }); + } + $('#preliminary-story-submit').on('click', preliminaryStorySubmit); \ No newline at end of file diff --git a/views/stories/preliminary-submit.jade b/views/stories/preliminary-submit.jade index 31ef779fcd..4bc8ba873c 100644 --- a/views/stories/preliminary-submit.jade +++ b/views/stories/preliminary-submit.jade @@ -44,4 +44,12 @@ } }); } - $('#preliminary-story-submit').on('click', preliminaryStorySubmit); \ No newline at end of file + $('#preliminary-story-submit').on('click', preliminaryStorySubmit); + + + arr = $( "h3 input:checked" ) + .map(function() { + return this.id; + }) + .get() + .join('&'); \ No newline at end of file