context = window rest = context.JK.Rest() @JamClassStudentLandingPage = React.createClass({ render: () -> loggedIn = context.JK.currentUserId? if this.state.done ctaButtonText = 'sending you in...' else if this.state.processing ctaButtonText = 'hold on...' else if loggedIn ctaButtonText = 'TRY TESTDRIVE' else ctaButtonText = 'SIGN UP' if loggedIn register = `` else if this.state.loginErrors? for key, value of this.state.loginErrors break errorText = context.JK.getFullFirstError(key, this.state.loginErrors, {email: 'Email', password: 'Password', 'terms_of_service': 'The terms of service'}) register = `
{errorText}
` if @props.package? ctaBoxContents = `

Sign up for this amazing TestDrive offer now!

When you sign up below, we will ask you to pay for your TestDrive package, and then we'll forward your lesson requests to these teachers for scheduling.

We will not share your email. See our privacy policy

{register}

We'll give you 1:1 help to get set up and ready to go with our free app.

` else ctaBoxContents = `

Sign up now. You have no obligation to buy anything. Signing up makes you eligible for our TestDrive offers.

After signing up, you can search our community of world-class instructors. If you book a TestDrive lesson you can choose to TestDrive 4, 2, or 1 teachers at that time.

We will not share your email. See our privacy policy

{register}

And pick your teachers now!

We'll give you 1:1 help to get set up and ready to go with our free app.

` `

Let Us Find You The Perfect Music Teacher

And Connect You Online With Our Patented, Unique Technology

as seen on
Sign Up for TestDrive
{ctaBoxContents}

The Future of Music Education Is Here

  • Connect with the best teacher for you, not the closest
  • TestDrive multiple teachers to find your ideal match
  • Enjoy studio quality audio in online sessions
  • Play music with your teacher live and in sync
  • Avoid the time and hassle of travel to and from lessons
  • Record lessons to refer back to them anytime
  • Use JamTracks to learn and play with your favorite music
  • Practice what you've learned in online sessions with others

` getInitialState: () -> {loginErrors: null, processing: false} privacyPolicy: (e) -> e.preventDefault() context.JK.popExternalLink('/corp/privacy') termsClicked: (e) -> e.preventDefault() context.JK.popExternalLink('/corp/terms') componentDidMount: () -> $root = $(this.getDOMNode()) $checkbox = $root.find('.terms-checkbox') context.JK.checkbox($checkbox) # add item to cart, create the user if necessary, and then place the order to get the free JamTrack. ctaClick: (e) -> e.preventDefault() return if @state.processing @setState({loginErrors: null}) loggedIn = context.JK.currentUserId? if loggedIn @markStudent() else @createUser() @setState({processing: true}) createTestDriveData: () -> test_drive_package = null if @props.package? test_drive_package ={} if window.teacherModifications? teachers = window.teacherModifications else teachers = @props.package.teachers test_drive_package.name = @props.package.name test_drive_package.teachers = teachers test_drive_package markStudent: () -> test_drive_package = @createTestDriveData() rest.updateUser({student: true, test_drive_package: test_drive_package}) .done((response) => this.setState({done: true}) if test_drive_package? choice = response.test_drive_package_choices?[0] if choice? context.location = '/client#/jamclass/lesson-payment/package_' + choice.id else context.location = '/client#/jamclass/searchOptions' else context.location = '/client#/jamclass/searchOptions' ) .fail((jqXHR) => this.setState({processing: false}) context.JK.app.notifyServerError(jqXHR, "Unable to Mark As Student") ) createUser: () -> $form = $('.jamtrack-signup-form') email = $form.find('input[name="email"]').val() password = $form.find('input[name="password"]').val() terms = $form.find('input[name="terms"]').is(':checked') test_drive_package = @createTestDriveData() rest.signup({email: email, password: password, first_name: null, last_name: null, terms: terms, student: true, test_drive_package: test_drive_package}) .done((response) => @setState({done: true}) if test_drive_package? choice = response.test_drive_package_choices?[0] if choice? context.location = '/client#/jamclass/lesson-payment/package_' + choice.id else context.location = '/client#/jamclass/searchOptions' else context.location = '/client#/jamclass/searchOptions' ).fail((jqXHR) => @setState({processing: false}) if jqXHR.status == 422 response = JSON.parse(jqXHR.responseText) if response.errors @setState({loginErrors: response.errors}) else context.JK.app.notify({title: 'Unknown Signup Error', text: jqXHR.responseText}) else context.JK.app.notifyServerError(jqXHR, "Unable to Sign Up") ) @setState({processing: true}) })