@JamClassStudentLandingMiddlePage = React.createClass({ avatar: (name = 'your choice', photo_url = '/assets/shared/avatar_generic.png') -> `
{name}
` getInitialState: () -> { modified: false package_type: null teachers: null } selector: (count, e) -> e.preventDefault() # cheesy way to pass the page data to the dialog window.page_data = @props window.JK.app.layout.showDialog('test-drive-package-dialog', {d1: count.toString()}).one(window.JK.EVENTS.DIALOG_CLOSED, (e, data) => #... code if !data.canceled # dialog wasn't cancelled, so let's check the value of our result: @setState(data.result) @setState({modified: true}) window.teacherModifications = data.result.teachers $ctaBox = $('.preview-area.jam-class') $.scrollTo($ctaBox, {duration: 500, offset: 0}) setTimeout((() => window.JK.HelpBubbleHelper.testDrivePackageGo($ctaBox, 'body', data.result.package_type)), 2500) ) componentDidMount: () -> @root = $(@getDOMNode()) @root.find('.bio p').dotdotdot() componentDidUpdate:( ) -> @root.find('.bio p').dotdotdot() render: () -> if this.props.package? package_type = this.state.package_type || this.props.package.package_type if package_type == '4' description = `

The single most important factor in the success of your music lessons is your teacher. You wouldn't marry the first person you date, right?

Take full 30-minute lessons from each of these 4 amazing teachers for just $12.50 each - a total of $49.99. Then you can pick the one who is best for you to continue your musical journey, with the confidence that your investment in lessons will deliver maximum growth!

` options = `

Like the TestDrive concept, but 4 teachers is too many for you?

` else if package_type == '2' description = `

The single most important factor in the success of your music lessons is your teacher. You wouldn't marry the first person you date, right?

Take full 30-minute lessons from each of these 2 amazing teachers for just $14.99 each - a total of $29.99. Then you can pick the one who is best for you to continue your musical journey, with the confidence that your investment in lessons will deliver maximum growth!

` options = `

Like the TestDrive concept, but prefer not to try 2 different teachers?

` else description = `

Take a full 30-minute lesson from this great teacher for just $14.99 - half the cost of a typical music lesson. You can make sure everything is working great, and then continue your musical journey with the confidence that your investment in lessons will deliver maximum growth!

` options = `

You can book a TestDrive lesson with this awesome teacher now!

Or you can search all of our teachers and then book a TestDrive package.

` teacherList = @state.teachers || this.props.package.teachers if @state.modified options = null teachers = [] for teacher in teacherList biography = teacher.biography biography = biography.replace(/\n/g, "
") teachers.push( `
{this.avatar(teacher.name, teacher.photo_url)}

`) `

SIGN UP FOR TESTDRIVE NOW!

{description} {teachers} {options}
` else `

SIGN UP FOR TESTDRIVE NOW!

The single most important factor in the success of your music lessons is your teacher. You wouldn't marry the first person you date, right? Our TestDrive program lets you:

Then continue your lessons with the best teacher for you!

Join 40,000+ other musicians in the JamKazam community. Sign up for TestDrive today, and you'll be eligible for any of the three special offers above!

Not sure if this is for you? Scroll down to learn more...

` })