mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Add schoolName field to StudentSignupModal
This commit is contained in:
parent
8e1143b519
commit
26e321d9e7
3 changed files with 21 additions and 10 deletions
|
@ -4,4 +4,7 @@
|
|||
margin-bottom: 10px
|
||||
|
||||
.form
|
||||
margin: 0 25%
|
||||
margin: 0 25%
|
||||
|
||||
.modal-dialog
|
||||
margin-top: 0
|
||||
|
|
|
@ -13,22 +13,30 @@ block modal-body-content
|
|||
label.control-label(for="email")
|
||||
span(data-i18n="general.email")
|
||||
input#email.input-large.form-control(name="email", type="email")
|
||||
.help-block use your school email if you have one
|
||||
.form-group
|
||||
label.control-label(for="name")
|
||||
span(data-i18n="general.name") Name
|
||||
if me.get('name')
|
||||
input#name.input-large.form-control(name="name", type="text", value="#{me.get('name')}")
|
||||
else
|
||||
input#name.input-large.form-control(name="name", type="text", value="", placeholder="Anoner")
|
||||
input#name.input-large.form-control(name="name", type="text", value="", placeholder="e.g. Alex W the Skater")
|
||||
.help-block a unique name no one has chosen
|
||||
.form-group
|
||||
label.control-label(for="password")
|
||||
span(data-i18n="general.password") Password
|
||||
input#password.input-large.form-control(name="password", type="password")
|
||||
.help-block pick something you can remember
|
||||
.form-group
|
||||
label.control-label(for="class-code")
|
||||
label.control-label(for="class-code-input")
|
||||
span Class Code
|
||||
input#class-code-input.input-large.form-control(name="class-code")
|
||||
input#class-code-input.input-large.form-control(name="classCode")
|
||||
.help-block optional - ask your teacher to give you one!
|
||||
.form-group
|
||||
label.control-label(for="school-input")
|
||||
span(data-i18n="signup.school_name") School Name and City
|
||||
input#school-input.input-large.form-control(name="schoolName", data-i18n="[placeholder]signup.school_name_placeholder")
|
||||
.help-block optional - what school do you go to?
|
||||
|
||||
#errors-alert.alert.alert-danger.hide
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ Classroom = require 'models/Classroom'
|
|||
module.exports = class StudentSignUpModal extends ModalView
|
||||
id: 'student-sign-up-modal'
|
||||
template: template
|
||||
|
||||
|
||||
events:
|
||||
'click #sign-up-btn': 'onClickSignUpButton'
|
||||
'submit form': 'onSubmitForm'
|
||||
|
@ -58,8 +58,8 @@ module.exports = class StudentSignUpModal extends ModalView
|
|||
return unless @emailCheck()
|
||||
# TODO: consolidate with AuthModal logic, or make user creation process less magical, more RESTful
|
||||
data = forms.formToObject @$el
|
||||
delete data['class-code']
|
||||
for key, val of me.attributes when key in ['preferredLanguage', 'testGroupNumber', 'dateCreated', 'wizardColor1', 'name', 'music', 'volume', 'emails']
|
||||
delete data.classCode
|
||||
for key, val of me.attributes when key in ['preferredLanguage', 'testGroupNumber', 'dateCreated', 'wizardColor1', 'name', 'music', 'volume', 'emails', 'schoolName']
|
||||
data[key] ?= val
|
||||
Backbone.Mediator.publish "auth:signed-up", {}
|
||||
data.emails ?= {}
|
||||
|
@ -74,7 +74,7 @@ module.exports = class StudentSignUpModal extends ModalView
|
|||
error: @onCreateUserError
|
||||
success: @onCreateUserSuccess
|
||||
})
|
||||
|
||||
|
||||
onCreateUserError: (model, jqxhr) =>
|
||||
# really need to make our server errors uniform
|
||||
if jqxhr.responseJSON
|
||||
|
@ -85,10 +85,10 @@ module.exports = class StudentSignUpModal extends ModalView
|
|||
message = jqxhr.responseText
|
||||
@disableModalInProgress(@$el)
|
||||
@$('#errors-alert').text(message).removeClass('hide')
|
||||
|
||||
|
||||
onCreateUserSuccess: =>
|
||||
classCode = @$('#class-code-input').val()
|
||||
if classCode
|
||||
url = "/courses/students?_cc="+classCode
|
||||
application.router.navigate(url)
|
||||
window.location.reload()
|
||||
window.location.reload()
|
||||
|
|
Loading…
Reference in a new issue