Commit 99c1f3f0 authored by Ray Schamp's avatar Ray Schamp

Avoid adding click event properties to formData

Setting onClick to onNextStep directly caused click event data to be passed in handleAdvanceStep, which then merged it with the formData state in student registration. This caused issues.
parent 2df91125
...@@ -1332,45 +1332,58 @@ const IntlTeacherApprovalStep = injectIntl(TeacherApprovalStep); ...@@ -1332,45 +1332,58 @@ const IntlTeacherApprovalStep = injectIntl(TeacherApprovalStep);
/* /*
* CLASS INVITE NEW STUDENT STEP * CLASS INVITE NEW STUDENT STEP
*/ */
const ClassInviteNewStudentStep = props => ( class ClassInviteNewStudentStep extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleNextStep'
]);
}
handleNextStep () {
return this.props.onNextStep();
}
render () {
return (
<Slide className="registration-step class-invite-step"> <Slide className="registration-step class-invite-step">
{props.waiting ? [ {this.props.waiting ? [
<Spinner key="spinner" /> <Spinner key="spinner" />
] : [ ] : [
<Avatar <Avatar
className="invite-avatar" className="invite-avatar"
key="avatar" key="avatar"
src={props.classroom.educator.profile.images['50x50']} src={this.props.classroom.educator.profile.images['50x50']}
/>, />,
<h2 key="username">{props.classroom.educator.username}</h2>, <h2 key="username">{this.props.classroom.educator.username}</h2>,
<p <p
className="description" className="description"
key="description" key="description"
> >
{props.intl.formatMessage({id: 'registration.classroomInviteNewStudentStepDescription'})} {this.props.intl.formatMessage({id: 'registration.classroomInviteNewStudentStepDescription'})}
</p>, </p>,
<Card key="card"> <Card key="card">
<div className="contents"> <div className="contents">
<h3>{props.classroom.title}</h3> <h3>{this.props.classroom.title}</h3>
<img <img
className="class-image" className="class-image"
src={props.classroom.images['250x150']} src={this.props.classroom.images['250x150']}
/> />
</div> </div>
<NextStepButton <NextStepButton
text={props.intl.formatMessage({id: 'general.getStarted'})} text={this.props.intl.formatMessage({id: 'general.getStarted'})}
waiting={props.waiting} waiting={this.props.waiting}
onClick={props.onNextStep} onClick={this.handleNextStep}
/> />
</Card>, </Card>,
<StepNavigation <StepNavigation
active={props.activeStep} active={this.props.activeStep}
key="step" key="step"
steps={props.totalSteps - 1} steps={this.props.totalSteps - 1}
/> />
]} ]}
</Slide> </Slide>
); );
}
}
ClassInviteNewStudentStep.propTypes = { ClassInviteNewStudentStep.propTypes = {
activeStep: PropTypes.number, activeStep: PropTypes.number,
...@@ -1398,47 +1411,62 @@ const IntlClassInviteNewStudentStep = injectIntl(ClassInviteNewStudentStep); ...@@ -1398,47 +1411,62 @@ const IntlClassInviteNewStudentStep = injectIntl(ClassInviteNewStudentStep);
/* /*
* CLASS INVITE EXISTING STUDENT STEP * CLASS INVITE EXISTING STUDENT STEP
*/ */
const ClassInviteExistingStudentStep = props => ( class ClassInviteExistingStudentStep extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleNextStep'
]);
}
handleNextStep () {
return this.props.onNextStep();
}
render () {
return (
<Slide className="registration-step class-invite-step"> <Slide className="registration-step class-invite-step">
{props.waiting ? [ {this.props.waiting ? [
<Spinner key="spinner" /> <Spinner key="spinner" />
] : [ ] : [
<h2 key="username">{props.studentUsername}</h2>, <h2 key="username">{this.props.studentUsername}</h2>,
<p <p
className="description" className="description"
key="description" key="description"
> >
{props.intl.formatMessage({id: 'registration.classroomInviteExistingStudentStepDescription'})} {this.props.intl.formatMessage({
id: 'registration.classroomInviteExistingStudentStepDescription'
})}
</p>, </p>,
<Card key="card"> <Card key="card">
<div className="contents"> <div className="contents">
<h3>{props.classroom.title}</h3> <h3>{this.props.classroom.title}</h3>
<img <img
className="class-image" className="class-image"
src={props.classroom.images['250x150']} src={this.props.classroom.images['250x150']}
/> />
<p>{props.intl.formatMessage({id: 'registration.invitedBy'})}</p> <p>{this.props.intl.formatMessage({id: 'registration.invitedBy'})}</p>
<p><strong>{props.classroom.educator.username}</strong></p> <p><strong>{this.props.classroom.educator.username}</strong></p>
</div> </div>
<NextStepButton <NextStepButton
text={props.intl.formatMessage({id: 'general.getStarted'})} text={this.props.intl.formatMessage({id: 'general.getStarted'})}
waiting={props.waiting} waiting={this.props.waiting}
onClick={props.onNextStep} onClick={this.handleNextStep}
/> />
</Card>, </Card>,
<p key="logout"> <p key="logout">
<a onClick={props.onHandleLogOut}> <a onClick={this.props.onHandleLogOut}>
{props.intl.formatMessage({id: 'registration.notYou'})} {this.props.intl.formatMessage({id: 'registration.notYou'})}
</a> </a>
</p>, </p>,
<StepNavigation <StepNavigation
active={props.activeStep} active={this.props.activeStep}
key="step" key="step"
steps={props.totalSteps - 1} steps={this.props.totalSteps - 1}
/> />
]} ]}
</Slide> </Slide>
); );
}
}
ClassInviteExistingStudentStep.propTypes = { ClassInviteExistingStudentStep.propTypes = {
activeStep: PropTypes.number, activeStep: PropTypes.number,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment