-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teachercon 18-19 Teacher Registration #19874
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1d9c94c
add all framework content for new teachercon registration form
Hamms 5828334
only support teacher registrations for now
Hamms ea3e8a4
add application-type helpers to a new base formcomponent
Hamms 9666fca
update teachercon1819 form components to use Labeled helpers
Hamms 245947a
Add the rest of the content for teachercon registration form
Hamms 7c9f055
fix various minor errors
Hamms ece39a9
add API endpoint and validation for creating new registration
Hamms ec4292f
add final two form pages
Hamms b920634
move some shared constants into the actual shared constants workflow
Hamms a095e17
add tests for teachercon1819 registration model
Hamms e08c5f7
add actual copy for submitted and unauthorized cases
Hamms 6bd5267
use Object.keys to automatically generate associatedFields
Hamms 5e484b4
open external links in new window
Hamms 05f9d32
enable form sessionStorage now that primary development is done
Hamms b569c2e
only allow 'Yes' response for releases
Hamms File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
apps/src/code-studio/pd/teachercon1819_registration/Confirmation.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
FormGroup, | ||
} from 'react-bootstrap'; | ||
|
||
import Teachercon1819FormComponent from './Teachercon1819FormComponent'; | ||
|
||
export default class Confirmation extends Teachercon1819FormComponent { | ||
static associatedFields = []; | ||
|
||
render() { | ||
return ( | ||
<FormGroup> | ||
{this.isTeacherApplication() && | ||
<p> | ||
We're excited you're planning to join the Professional Learning | ||
Program! You will receive more information about travel approximately | ||
six weeks before TeacherCon. In the meantime, please <strong>do not</strong> book your | ||
flight, and make sure to contact <a href="mailto:teacher@code.org">teacher@code.org</a> with any questions. | ||
We look forward to meeting you this summer! | ||
</p> | ||
} | ||
|
||
{this.isFacilitatorApplication() && | ||
<p> | ||
We're excited you're planning to join us this summer! You will | ||
receive more information about travel approximately six weeks before | ||
TeacherCon. In the meantime, please <strong>do not</strong> book your flight, and make | ||
sure to contact <a href="mailto:facilitators@code.org">facilitators@code.org</a> with any questions. We look | ||
forward to meeting you this summer! | ||
</p> | ||
} | ||
|
||
{this.isPartnerApplication() && | ||
<p> | ||
We're excited you're planning to join us this summer! You will | ||
receive more information about travel approximately six weeks before | ||
TeacherCon. In the meantime, please <strong>do not</strong> book your flight, and make | ||
sure to contact your Outreach Regional Manager with any questions. We | ||
look forward to meeting you this summer! | ||
</p> | ||
} | ||
</FormGroup> | ||
); | ||
} | ||
} | ||
|
103 changes: 103 additions & 0 deletions
103
apps/src/code-studio/pd/teachercon1819_registration/Joining.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import React from 'react'; | ||
import { | ||
FormGroup, | ||
ControlLabel | ||
} from 'react-bootstrap'; | ||
import Teachercon1819FormComponent from './Teachercon1819FormComponent'; | ||
import UsPhoneNumberInput from "../form_components/UsPhoneNumberInput"; | ||
|
||
import { TeacherSeatAcceptanceOptions } from '@cdo/apps/generated/pd/teachercon1819RegistrationConstants'; | ||
|
||
export default class Joining extends Teachercon1819FormComponent { | ||
static labels = { | ||
preferredFirstName: "Preferred first name", | ||
lastName: "Last name", | ||
email: "Email", | ||
phone: "Phone number", | ||
teacherAcceptSeat: "Do you want to accept your seat in the Professional Learning Program? (Select one)", | ||
teacherWaitlistExplain: "Optional: Please explain more why you cannot accept your seat in the Professional Learning Program.", | ||
teacherDeclineExplain: "Optional: Please explain more why you cannot accept your seat in the Professional Learning Program.", | ||
} | ||
|
||
static associatedFields = Object.keys(Joining.labels) | ||
|
||
/** | ||
* @override | ||
*/ | ||
static getErrorMessages(data) { | ||
const formatErrors = {}; | ||
|
||
if (!UsPhoneNumberInput.isValid(data.phone)) { | ||
formatErrors.phone = "Must be a valid phone number including area code"; | ||
} | ||
|
||
return formatErrors; | ||
} | ||
|
||
render() { | ||
return ( | ||
<FormGroup> | ||
<h4>Section 1: Are you joining us?</h4> | ||
|
||
<FormGroup> | ||
{this.inputFor("preferredFirstName")} | ||
{this.inputFor("lastName")} | ||
{this.inputFor("email", { readOnly: true })} | ||
{this.usPhoneNumberInputFor("phone")} | ||
</FormGroup> | ||
<FormGroup> | ||
<ControlLabel> | ||
Your assigned summer workshop is: | ||
<br /> | ||
<strong> | ||
TeacherCon {this.props.city}, {this.props.date} | ||
</strong> | ||
</ControlLabel> | ||
</FormGroup> | ||
|
||
{this.isTeacherApplication() && | ||
<FormGroup> | ||
<p> | ||
As a reminder, all participants in the Professional Learning Program | ||
are expected to: | ||
</p> | ||
<ul> | ||
<li>Attend their assigned summer workshop</li> | ||
<li>Attend their assigned academic year workshops</li> | ||
<li>Teach this curriculum in the 2018-19 school year</li> | ||
</ul> | ||
{this.radioButtonsFor("teacherAcceptSeat")} | ||
{( | ||
this.props.data.teacherAcceptSeat === TeacherSeatAcceptanceOptions.withdrawDate || | ||
this.props.data.teacherAcceptSeat === TeacherSeatAcceptanceOptions.withdrawOther | ||
) && | ||
<FormGroup> | ||
<p> | ||
Thank you for letting us know. We will remove your seat in your | ||
assigned summer workshop for now, and add you to our waitlist. | ||
Please complete the rest of this form so we have your information | ||
in our records, and we will contact you if a seat becomes | ||
available for an alternate date. | ||
</p> | ||
{this.inputFor("teacherWaitlistExplain", { required: false })} | ||
</FormGroup> | ||
} | ||
|
||
{this.props.data.teacherAcceptSeat === TeacherSeatAcceptanceOptions.decline && | ||
<FormGroup> | ||
<p> | ||
Thank you for letting us know. You do not need to complete the rest | ||
of this form. We will close your application today, but please feel | ||
free to use all of our free curricula and resources available at | ||
code.org/educate. We hope you consider applying again in 2019! | ||
</p> | ||
{this.inputFor("teacherDeclineExplain", { required: false })} | ||
</FormGroup> | ||
} | ||
</FormGroup> | ||
} | ||
|
||
</FormGroup> | ||
); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
apps/src/code-studio/pd/teachercon1819_registration/Releases.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
FormGroup, | ||
ControlLabel | ||
} from 'react-bootstrap'; | ||
|
||
import Teachercon1819FormComponent from './Teachercon1819FormComponent'; | ||
|
||
export default class Releases extends Teachercon1819FormComponent { | ||
static associatedFields = [ | ||
'photoRelease', | ||
'liabilityWaiver', | ||
'agreeShareContact', | ||
]; | ||
|
||
static labels = { | ||
photoRelease: "Do you agree to the conditions in the photo release?", | ||
liabilityWaiver: "Do you agree to the conditions in the liability waiver?", | ||
agreeShareContact: "By submitting this application, I agree to share my contact information and registration with Code.org's Regional Partners.", | ||
}; | ||
|
||
render() { | ||
return ( | ||
<FormGroup> | ||
<h4>Section 3: Releases</h4> | ||
<FormGroup> | ||
<ControlLabel> | ||
Please read this <a target="_blank" href="https://docs.google.com/document/d/12NVUcqccNRbVukoGMCserwSpg4vfG0vNlEqTxr6oit0/edit">photo release.</a> | ||
</ControlLabel> | ||
{this.selectFor("photoRelease", { placeholder: "--" })} | ||
<ControlLabel> | ||
Please read this <a target="_blank" href="https://docs.google.com/document/d/15N5N1m-BPCU7obQDf7FLLhEt3IComFGB1u3N6kEQR6k/edit">liability waiver.</a> | ||
</ControlLabel> | ||
{this.selectFor("liabilityWaiver", { placeholder: "--" })} | ||
</FormGroup> | ||
|
||
{( | ||
this.isTeacherApplication() || this.isFacilitatorApplication() | ||
) && | ||
<FormGroup> | ||
<ControlLabel> | ||
<strong> | ||
Code.org works closely with local Regional Partners to organize and | ||
deliver the Professional Learning Program. By enrolling in this | ||
program, you are agreeing to allow Code.org to share information on | ||
how you use Code.org and the Professional Learning resources with your | ||
Regional Partner and school district. In order to organize the | ||
workshops and support you, our partners need to know who is attending | ||
and what content is relevant for them. So, we will share your contact | ||
information, which courses/units you are using in your classrooms and | ||
aggregate data about your classes. This includes the number of | ||
students in your classes, the demographic breakdown of your classroom, | ||
and the name of your school and district. We will not share any | ||
information about individual students with our Regional Partners - all | ||
information will be de-identified and aggregated. Our Regional | ||
Partners are contractually obliged to treat this information with the | ||
same level of confidentiality as Code.org. | ||
</strong> | ||
</ControlLabel> | ||
{this.singleCheckboxFor("agreeShareContact")} | ||
</FormGroup> | ||
} | ||
</FormGroup> | ||
); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/src/code-studio/pd/teachercon1819_registration/Teachercon1819FormComponent.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import LabeledFormComponent from '../form_components/LabeledFormComponent'; | ||
|
||
const TEACHER = "Teacher"; | ||
const FACILITATOR = "Facilitator"; | ||
const PARTNER = "Partner"; | ||
|
||
export default class Teachercon1819FormComponent extends LabeledFormComponent { | ||
|
||
isTeacherApplication() { | ||
return this.props.applicationType === TEACHER; | ||
} | ||
|
||
isFacilitatorApplication() { | ||
return this.props.applicationType === FACILITATOR; | ||
} | ||
|
||
isPartnerApplication() { | ||
return this.props.applicationType === PARTNER; | ||
} | ||
|
||
} |
107 changes: 107 additions & 0 deletions
107
apps/src/code-studio/pd/teachercon1819_registration/Teachercon1819Registration.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import {PropTypes} from 'react'; | ||
import FormController from '../form_components/FormController'; | ||
|
||
import Welcome from './Welcome'; | ||
import Joining from './Joining'; | ||
import TravelPlans from './TravelPlans'; | ||
import Releases from './Releases'; | ||
import Confirmation from './Confirmation'; | ||
|
||
import { TeacherSeatAcceptanceOptions } from '@cdo/apps/generated/pd/teachercon1819RegistrationConstants'; | ||
|
||
export default class Teachercon1819Registration extends FormController { | ||
static propTypes = { | ||
...FormController.propTypes, | ||
applicationId: PropTypes.number.isRequired, | ||
applicationType: PropTypes.string.isRequired, | ||
course: PropTypes.string.isRequired, | ||
city: PropTypes.string.isRequired, | ||
date: PropTypes.string.isRequired, | ||
email: PropTypes.string.isRequired, | ||
firstName: PropTypes.string, | ||
lastName: PropTypes.string, | ||
phone: PropTypes.string, | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
// initialize some fields with reasonable defaults | ||
this.state.data = { | ||
...this.state.data, | ||
email: this.props.email, | ||
preferredFirstName: this.props.firstName, | ||
lastName: this.props.lastName, | ||
phone: this.props.phone | ||
}; | ||
} | ||
|
||
static sessionStorageKey = "Teachercon1819Registration"; | ||
|
||
/** | ||
* @override | ||
*/ | ||
getPageComponents() { | ||
const pageComponents = [ | ||
Welcome, | ||
Joining, | ||
TravelPlans, | ||
Releases, | ||
]; | ||
|
||
// We want to include the confirmation page by default, but remove it if the | ||
// teacher has responded to the "accept seat" question with something other | ||
// than yes. It would of course be easier to just add the confirmation page | ||
// once they respond yes, but if we do that then the user-visible page count | ||
// will _grow_ as they progress through the form, which is a much weirder | ||
// user experience than it shrinking. | ||
if (!(this.state.data.teacherAcceptSeat && this.state.data.teacherAcceptSeat !== TeacherSeatAcceptanceOptions.accept)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice explanation :) |
||
pageComponents.push(Confirmation); | ||
} | ||
|
||
return pageComponents; | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
getPageProps() { | ||
return { | ||
...super.getPageProps(), | ||
applicationType: this.props.applicationType, | ||
course: this.props.course, | ||
city: this.props.city, | ||
date: this.props.date, | ||
email: this.props.email, | ||
firstName: this.props.firstName, | ||
lastName: this.props.lastName, | ||
phone: this.props.phone, | ||
}; | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
serializeFormData() { | ||
return { | ||
...super.serializeFormData(), | ||
applicationId: this.props.applicationId | ||
}; | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
onSuccessfulSubmit() { | ||
// Let the server display a confirmation page as appropriate | ||
window.location.reload(true); | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
shouldShowSubmit() { | ||
return super.shouldShowSubmit() || | ||
this.state.data.teacherAcceptSeat === TeacherSeatAcceptanceOptions.decline; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first 2 sentences are the same in all cases. Might it make sense to split that out into its own paragraph, supplied once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, one says "join the Professional Learning Program" and the other two say "join us this summer" :/
I'mma just leave it as is; if we get lots of changes coming in to the copy I'll probably try and dedup to make those easier.