mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
Merge pull request #754 from rschamp/bugfix/747
Make the student registration views more consistent with each other
This commit is contained in:
commit
cd3eafe9a0
2 changed files with 24 additions and 21 deletions
|
@ -90,30 +90,33 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
|
||||||
var demographicsDescription = this.props.intl.formatMessage({
|
var demographicsDescription = this.props.intl.formatMessage({
|
||||||
id: 'registration.studentPersonalStepDescription'});
|
id: 'registration.studentPersonalStepDescription'});
|
||||||
var registrationErrors = this.state.registrationErrors;
|
var registrationErrors = this.state.registrationErrors;
|
||||||
var sessionFetched = this.props.session.status === sessionStatus.FETCHED;
|
if (this.props.session.status === sessionStatus.FETCHED && !(
|
||||||
if (sessionFetched &&
|
this.props.session.session.permissions &&
|
||||||
!(this.props.session.session.permissions.student &&
|
this.props.session.session.permissions.student &&
|
||||||
this.props.session.session.flags.must_complete_registration)) {
|
this.props.session.session.flags.must_complete_registration)
|
||||||
|
) {
|
||||||
registrationErrors = {
|
registrationErrors = {
|
||||||
__all__: this.props.intl.formatMessage({id: 'registration.mustBeNewStudent'})
|
__all__: this.props.intl.formatMessage({id: 'registration.mustBeNewStudent'})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Deck className="student-registration">
|
<Deck className="student-registration">
|
||||||
{sessionFetched && this.state.classroom ?
|
{registrationErrors ? (
|
||||||
(registrationErrors ?
|
<Steps.RegistrationError>
|
||||||
<Steps.RegistrationError>
|
<ul>
|
||||||
<ul>
|
{Object.keys(registrationErrors).map(function (field) {
|
||||||
{Object.keys(registrationErrors).map(function (field) {
|
var label = field + ': ';
|
||||||
var label = field + ': ';
|
if (field === '__all__') {
|
||||||
if (field === '__all__') {
|
label = '';
|
||||||
label = '';
|
}
|
||||||
}
|
return (<li>{label}{registrationErrors[field]}</li>);
|
||||||
return (<li>{label}{registrationErrors[field]}</li>);
|
})}
|
||||||
})}
|
</ul>
|
||||||
</ul>
|
</Steps.RegistrationError>
|
||||||
</Steps.RegistrationError>
|
) : (
|
||||||
:
|
this.state.waiting || !this.state.classroom ? (
|
||||||
|
<Spinner />
|
||||||
|
) : (
|
||||||
<Progression {... this.state}>
|
<Progression {... this.state}>
|
||||||
<Steps.ClassInviteStep classroom={this.state.classroom}
|
<Steps.ClassInviteStep classroom={this.state.classroom}
|
||||||
messages={this.props.messages}
|
messages={this.props.messages}
|
||||||
|
@ -134,9 +137,7 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
|
||||||
waiting={this.state.waiting} />
|
waiting={this.state.waiting} />
|
||||||
</Progression>
|
</Progression>
|
||||||
)
|
)
|
||||||
:
|
)}
|
||||||
<Spinner />
|
|
||||||
}
|
|
||||||
</Deck>
|
</Deck>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,12 @@ var StudentRegistration = intl.injectIntl(React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
componentDidMount: function () {
|
componentDidMount: function () {
|
||||||
|
this.setState({waiting: true});
|
||||||
api({
|
api({
|
||||||
uri: '/classrooms/' + this.props.classroomId,
|
uri: '/classrooms/' + this.props.classroomId,
|
||||||
params: {token: this.props.classroomToken}
|
params: {token: this.props.classroomToken}
|
||||||
}, function (err, body, res) {
|
}, function (err, body, res) {
|
||||||
|
this.setState({waiting: false});
|
||||||
if (err) {
|
if (err) {
|
||||||
return this.setState({
|
return this.setState({
|
||||||
registrationError: this.props.intl.formatMessage({
|
registrationError: this.props.intl.formatMessage({
|
||||||
|
|
Loading…
Reference in a new issue