diff --git a/db/up/lessons.sql b/db/up/lessons.sql index 443c867e7..f9598527d 100644 --- a/db/up/lessons.sql +++ b/db/up/lessons.sql @@ -1,8 +1,43 @@ + +CREATE TABLE lesson_package_types ( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + name VARCHAR NOT NULL, + description VARCHAR NOT NULL, + package_type VARCHAR(64) NOT NULL, + price NUMERIC(8,2), + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE lesson_package_purchases ( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + lesson_package_type_id VARCHAR(64) REFERENCES lesson_package_types(id) NOT NULL, + user_id VARCHAR(64) REFERENCES users(id) NOT NULL, + teacher_id VARCHAR(64) REFERENCES teachers(id), + price NUMERIC(8,2), + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + CREATE TABLE lesson_sessions ( id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), - music_session_id VARCHAR(64) FOREIGN KEY ON REFERENCES music_sessions(id) NOT NULL, + music_session_id VARCHAR(64) REFERENCES music_sessions(id) NOT NULL, lesson_type VARCHAR(64) NOT NULL, + teacher_id VARCHAR(64) REFERENCES teachers(id) NOT NULL, + lesson_package_purchase_id VARCHAR(64) REFERENCES lesson_package_purchases(id), duration INTEGER NOT NULL, price NUMERIC(8,2) NOT NULL, - -) \ No newline at end of file + teacher_complete BOOLEAN DEFAULT FALSE NOT NULL, + student_complete BOOLEAN DEFAULT FALSE NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +ALTER TABLE notifications ADD COLUMN lesson_session_id VARCHAR(64) REFERENCES lesson_sessions(id); + +ALTER TABLE users ADD COLUMN is_a_student BOOLEAN NOT NULL DEFAULT FALSE; +ALTER TABLE users ADD COLUMN is_a_teacher BOOLEAN NOT NULL DEFAULT FALSE; + +INSERT INTO lesson_package_types (id, name, description, package_type, price) VALUES ('single', 'Single Lesson', 'A single lesson purchased at the teacher''s price.', 'single', 0.00); +INSERT INTO lesson_package_types (id, name, description, package_type, price) VALUES ('single-free', 'Free Lesson', 'A free, single lesson.', 'single-free', 0.00); +INSERT INTO lesson_package_types (id, name, description, package_type, price) VALUES ('test-drive', 'Test Drive', 'Four reduced-price lessons which you can use to find that ideal teacher.', 'test-drive', 49.99); \ No newline at end of file diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index d655cff1e..2c3d9aa3e 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -264,7 +264,9 @@ require "jam_ruby/models/gift_card" require "jam_ruby/models/gift_card_purchase" require "jam_ruby/models/gift_card_type" require "jam_ruby/models/jam_track_session" - +require "jam_ruby/models/lesson_package_type" +require "jam_ruby/models/lesson_package_purchase" +require "jam_ruby/models/lesson_session" include Jampb module JamRuby diff --git a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb index 40d5480f0..84355a1ae 100644 --- a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb +++ b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb @@ -49,6 +49,36 @@ end end + def student_welcome_message(user) + @user = user + sendgrid_category "Welcome" + sendgrid_unique_args :type => "welcome_message" + + sendgrid_recipients([user.email]) + sendgrid_substitute('@USERID', [user.id]) + sendgrid_substitute(EmailBatchProgression::VAR_FIRST_NAME, [user.first_name]) + + mail(:to => user.email, :subject => "Welcome to JamKazam") do |format| + format.text + format.html + end + end + + def teacher_welcome_message(user) + @user = user + sendgrid_category "Welcome" + sendgrid_unique_args :type => "welcome_message" + + sendgrid_recipients([user.email]) + sendgrid_substitute('@USERID', [user.id]) + sendgrid_substitute(EmailBatchProgression::VAR_FIRST_NAME, [user.first_name]) + + mail(:to => user.email, :subject => "Welcome to JamKazam") do |format| + format.text + format.html + end + end + def password_changed(user) @user = user diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.html.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.html.erb new file mode 100644 index 000000000..177f38c92 --- /dev/null +++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.html.erb @@ -0,0 +1,119 @@ +<% provide(:title, 'Welcome to JamKazam!') %> + + +<% if !@user.anonymous? %> +
Hello <%= EmailBatchProgression::VAR_FIRST_NAME %> -- +
+<% end %> + + +We're delighted you have decided to join the JamKazam community of musicians, and we hope + + you will enjoy using JamKazam and JamTracks to play more music. Following are some + + resources and some things you can do to get the most out of JamKazam. +
+ + +Playing With JamTracks
+
+ JamTracks are the best way to play along with your favorite songs. Far better and different than
+
+ traditional backing tracks, our JamTracks are complete multi-track professional recordings, with
+
+ fully isolated tracks for each part of the music. And our free app and Internet service are packed
+
+ with features that give you unmatched creative freedom to learn, practice, record, play with
+
+ others, and share your performances. Here are some great JamTracks resources:
+
Play Live With Others from Different Locations on JamKazam
+ JamKazam’s free app lets musicians play together live and in sync from different locations over
+
+ the Internet. Kind of like Skype on super audio steroids, with ultra low latency and terrific audio
+
+ quality. You can set up online sessions that are public or private, for you alone or for others to
+
+ join. You can find and join others’ sessions, use backing tracks and loops in sessions, make
+
+ audio and video recordings of session performances, and more. Click here for a set of tutorial
+
+ videos that show how to use these features.
+
Teach or Take Online Music Lessons
+ If you teach music lessons and have tried to give lessons using Skype, you’ll know how
+
+ unsatisfactory that experience is. Audio quality is poor, and latency prohibits teacher and
+
+ student playing together at all. JamKazam is a terrific service for teaching and taking online
+
+ music lessons. If you want to use JamKazam for lessons, we’ll be happy to support both you and
+
+ your students in getting set up and ready to go.
+
Complete Your Profile
+ Every member of our community has a profile. It’s a great way to share a little bit about who
+
+ you are as a musician, as well as your musical interests. For example, what instruments do you
+
+ play? What musical genres do you like best? Are you interested in getting into a virtual/online
+
+ or a real-world band? And so on. Filling out your profile will help you connect with others with
+
+ common interests. To do this, go to www.jamkazam.com or launch the JamKazam app. Then
+
+ click on the Profile tile, and click the Edit Profile button.
+
Invite Your Friends
+ Have friends who are musicians? Invite them to join you to play together on JamKazam. To do
+
+ this, go to www.jamkazam.com or launch the JamKazam app. Then move your mouse over the
+
+ user icon in the top right corner of the screen. A menu will be displayed. Click Invite Friends in
+
+ this menu, and you can then use the options to invite your friends using their email addresses,
+
+ or via Facebook, or using your Google contacts.
+
+ +
Get Help
+
+ If you run into trouble and need help, please reach out to us. We will be glad to do everything
+
+ we can to answer your questions and get you up and running. You can visit our Support Portal
+
+ to find knowledge base articles and post questions that have not already been answered. You
+
+ can email us at support@jamkazam.com. And if you just want to chat, share tips and war
+
+ stories, and hang out with fellow JamKazamers, you can visit our Community Forum.
+
+ +
+
+
+ Again, welcome to JamKazam, and we hope you have a great time here!
+
Best Regards,
+ Team JamKazam
Hello <%= EmailBatchProgression::VAR_FIRST_NAME %> -- +
+<% end %> + + +We're delighted you have decided to join the JamKazam community of musicians, and we hope + + you will enjoy using JamKazam and JamTracks to play more music. Following are some + + resources and some things you can do to get the most out of JamKazam. +
+ + +Playing With JamTracks
+
+ JamTracks are the best way to play along with your favorite songs. Far better and different than
+
+ traditional backing tracks, our JamTracks are complete multi-track professional recordings, with
+
+ fully isolated tracks for each part of the music. And our free app and Internet service are packed
+
+ with features that give you unmatched creative freedom to learn, practice, record, play with
+
+ others, and share your performances. Here are some great JamTracks resources:
+
Play Live With Others from Different Locations on JamKazam
+ JamKazam’s free app lets musicians play together live and in sync from different locations over
+
+ the Internet. Kind of like Skype on super audio steroids, with ultra low latency and terrific audio
+
+ quality. You can set up online sessions that are public or private, for you alone or for others to
+
+ join. You can find and join others’ sessions, use backing tracks and loops in sessions, make
+
+ audio and video recordings of session performances, and more. Click here for a set of tutorial
+
+ videos that show how to use these features.
+
Teach or Take Online Music Lessons
+ If you teach music lessons and have tried to give lessons using Skype, you’ll know how
+
+ unsatisfactory that experience is. Audio quality is poor, and latency prohibits teacher and
+
+ student playing together at all. JamKazam is a terrific service for teaching and taking online
+
+ music lessons. If you want to use JamKazam for lessons, we’ll be happy to support both you and
+
+ your students in getting set up and ready to go.
+
Complete Your Profile
+ Every member of our community has a profile. It’s a great way to share a little bit about who
+
+ you are as a musician, as well as your musical interests. For example, what instruments do you
+
+ play? What musical genres do you like best? Are you interested in getting into a virtual/online
+
+ or a real-world band? And so on. Filling out your profile will help you connect with others with
+
+ common interests. To do this, go to www.jamkazam.com or launch the JamKazam app. Then
+
+ click on the Profile tile, and click the Edit Profile button.
+
Invite Your Friends
+ Have friends who are musicians? Invite them to join you to play together on JamKazam. To do
+
+ this, go to www.jamkazam.com or launch the JamKazam app. Then move your mouse over the
+
+ user icon in the top right corner of the screen. A menu will be displayed. Click Invite Friends in
+
+ this menu, and you can then use the options to invite your friends using their email addresses,
+
+ or via Facebook, or using your Google contacts.
+
+ +
Get Help
+
+ If you run into trouble and need help, please reach out to us. We will be glad to do everything
+
+ we can to answer your questions and get you up and running. You can visit our Support Portal
+
+ to find knowledge base articles and post questions that have not already been answered. You
+
+ can email us at support@jamkazam.com. And if you just want to chat, share tips and war
+
+ stories, and hang out with fellow JamKazamers, you can visit our Community Forum.
+
+ +
+
+
+ Again, welcome to JamKazam, and we hope you have a great time here!
+
Best Regards,
+ Team JamKazam
If you’re a music store and you sell products like instruments and accessories to musicians, + + JamKazam can add value to every sale you make to customers by enabling you to bundle high-value digital music products and services that are highly complementary to the products you + + are selling – at no additional cost to your customers. For example, you can bundle full + + multitrack recordings from our catalog of 4,000+ popular songs that let your customers play + + along with their favorite songs in incredibly innovative and fun ways, and you can + bundle free + + online music lessons that really work (unlike Skype, which is great for voice chat but horrible for + + music lessons) to help your customers connect with great teachers and stay better engaged + + with their instruments, so they’ll keep coming back for more music products from your store. + + Additionally, when your customers love these digital products and services and choose to buy + + more, we pay you a share of all revenues we earn from these sales, boosting your revenue and + + profit per sale, while simultaneously delivering greater value to your customer.
+ +If you’re a music school, JamKazam represents a platform far superior to Skype that you can use + + freely to teach your existing students online, both in your area and across the country to reach + + new markets and students. Skype’s audio quality for music is very poor. Its latency is so high + + that teacher and student cannot play together, and it suffers from a number of other critical + + limitations for music lessons, as it was built for voice chat – not music. In addition to delivering + + online music lessons that really work, JamKazam can drive more students to your school + and + + your teachers from our online lesson marketplace, helping you build your business faster and + + bigger.
+ +And if you’re both a music store and school, we can help you win in all these ways together. If + + this sounds interesting, read on to learn more about some of the unique things we’ve done and + + how they can help to grow your business.
+ + ++ JamTracks are full multitrack recordings of 4,000+ popular songs that deliver amazing fun and + + flexibility for musicians to play with their favorite artists and tunes. With JamTracks, you can: +
++ JamTracks sell for $1.99 each. Musicians love to play with these, and typically buy a few at a + + time. Imagine that you are selling a set of guitar strings to an electric guitar player. As a + + JamKazam affiliate, you can bundle free JamTracks with the strings sale, delighting your + + customer with the added value. And then when he/she buys more JamTracks, we pay you a + + share of that revenue, adding to your revenues, and improving your margin on your sales. This + + can be applied to just about anything you sell, as we have JamTracks with parts for almost every + + instrument, as well as vocals. And it’s easy to bundle, as you don’t have to specify particular + + songs per product that you sell. You can just give your customer a free JamTracks credit with + + each sale, and your customer can then redeem this credit online to choose their favorite songs. +
+ ++ Here is a video that shows more about how JamTracks work. +
+
+
+ + Where JamTracks are incredibly fun and versatile, JamClass is flat out amazing and mind + + blowing. We’ve spent the last 3 years building technology specifically to let musicians play + + together live in sync over the Internet from different locations with very high quality audio. And + + now we are using this technology to enable online music lessons in a very powerful way. +
+ ++ For the last several years, instructors have been experimenting with using Skype to teach online + + music lessons. But if you have tried this yourself or spoken with someone who has, you know + + that audio quality is extremely poor, and latency is far too high for a teacher and student to + + play together in lessons. The reason is that Skype was built for voice conferencing – i.e. for + + people to talk with each other – not for music. Skype uses a voice “codec” that processes all + + audio as if it were a human voice speaking, which crushes music audio. And voice conferencing + + apps like Skype work fine with 150 to 200 milliseconds of latency (lag), whereas for music you + + need latency far lower, in the 20 to 40 millisecond range. +
+ ++ In addition to audio quality and latency, JamKazam’s technology lets teacher and student + + record lessons and performances for later reference, open backing tracks in sessions to play + + with, use an in-session metronome, and other music-specific important features. +
+ ++ Here is a video that shows more about how JamKazam’s technology works for lessons. +
The affiliate program for music stores and schools is really simple. It’s free to sign up. Once + + you’ve signed up, you are assigned a JamKazam affiliate ID, which tracks your affiliate activities + + automatically. Today there are 3 ways to benefit from the affiliate program:
+ ++ In order to teach lessons using JamClass by JamKazam from your school facilities, in each room + + where you want to be able to teach online lessons you will need the following:
++ To have very high quality audio in your sessions, rather than using the built-in microphone on + + your computer to capture your instrumental and/or vocal audio, we strongly recommend using + + an external audio interface. An audio interface is a hardware product that connects to your + + computer and processes audio better than your computer alone. If you already own/use an + + audio interface, you can use the one you have. And if you don't, please read this help article on audio interfaces that can guide you to get what you need. You + can pick up a perfectly good + + interface very inexpensively, typically for less than $50. And you can use your new interface not + + just for JamClass, but also to make recordings of performances, etc. So it's a great thing to have + + for any music school in general. +
+ ++ Also, if possible, you’ll get the best audio quality and lowest latency if you can connect your + + computer to your Internet service using an Ethernet cable rather than a WiFi connection. In any + + application (including ours), WiFi is not great for low latency media streaming. If you have to + + use WiFi, it will be OK for 1:1 lessons, and still far, far better than Skype. But you’ll get the best + + performance if you can use a wired vs. wireless connection. +
+ ++ If you feel worried or confused about getting set up because you're not a "tech genius", we are + + happy to work with you 1:1 to answer your questions, and walk you through picking gear and + + setting it up. We'll even hop into an online test session with you, show you around the key + + features, and make sure you're ready to rock and roll online! Just email us at + + support@jamkazam.com, and tell us you need help getting set up for JamClass. We do this all + + the time. +
+ ++ Here is a video that shows more about how JamClass works from a teacher's perspective: +
If you're ready to sign up to join our affiliate program, just scroll back up to the top of this page, + + and enter your email address and a password to sign up. Once you've done this, we'll provide + + instructions and engage with you to do the following:
++ Our JamKazam staff will give you all the 1:1 help you need to get your gear set up for online + + lessons. Once you’ve started bundling free products and/or teaching, we’ll also need to set you + + up for direct deposit so we can deposit funds as they are earned through the program. +
+ ++ All of us here at JamKazam look forward to partnering with you to help both you and your + + customers and students succeed in both your musical and business endeavors! +
+
+
+ Sign up to enroll your store or school in our affiliate program.
+We’ll follow up to answer your questions and give you all the 1:1 help you need to get up and running. It’s easy, and your customers will love the added value.
+We will not share your email. See our privacy policy
+ {register} +See for yourself how we can help you deliver greater value to your customers while increasing your revenues.
++ Founded by a team that has built and sold companies to Google, eBay, GameStop and more, + + JamKazam has developed incredibly unique and engaging digital music technologies, content, + + and marketplaces used by our rapidly growing community of 30,000+ musicians. Now we’ve + + crafted an affiliate program specifically for music stores and music schools to increase your + + revenues while delighting your customers. Best of all, it’s free and easy to integrate into your + + business. +
+
Sign up and start getting students referred from our marketplace.
@@ -100,7 +100,23 @@ rest = context.JK.Rest() loggedIn = context.JK.currentUserId? + if loggedIn + @markTeacher() + else + @createUser() + @setState({processing:true}) + + markTeacher: () -> + rest.updateUser({teacher: true}) + .done((response) => + this.setState({done: true}) + context.location = '/client#/home' + ) + .fail((jqXHR) => + this.setState({processing: false}) + context.JK.app.notifyServerError(jqXHR, "Unable to Mark As Teacher") + ) createUser: () -> $form = $('.jamtrack-signup-form') @@ -108,10 +124,10 @@ rest = context.JK.Rest() password = $form.find('input[name="password"]').val() terms = $form.find('input[name="terms"]').is(':checked') - rest.signup({email: email, password: password, first_name: null, last_name: null, terms:terms}) + rest.signup({email: email, password: password, first_name: null, last_name: null, terms:terms, teacher : true}) .done((response) => - - + @setState({done: true}) + context.location = '/client#/home' ).fail((jqXHR) => @setState({processing:false}) if jqXHR.status == 422 @@ -124,6 +140,4 @@ rest = context.JK.Rest() context.JK.app.notifyServerError(jqXHR, "Unable to Sign Up") ) - - @setState({processing:true}) }) \ No newline at end of file diff --git a/web/app/assets/stylesheets/landings/individual_jamtrack.css.scss b/web/app/assets/stylesheets/landings/individual_jamtrack.css.scss index 21cce50ee..f2bf17864 100644 --- a/web/app/assets/stylesheets/landings/individual_jamtrack.css.scss +++ b/web/app/assets/stylesheets/landings/individual_jamtrack.css.scss @@ -43,27 +43,31 @@ body.web.individual_jamtrack { &.jam-class { - padding:20px 0; + &.thin { + width:663px; + } + + padding: 20px 0; &:nth-of-type(1) { - padding-top:80px; + padding-top: 80px; &.teachers { - padding-top:100px; + padding-top: 100px; } } - width:1050px; + width: 1050px; p { - line-height:125%; - margin-bottom:20px; + line-height: 125%; + margin-bottom: 20px; } a { - color:$cta-color; + color: $cta-color; } ol, ul, li { - font-size:16px; - line-height:125%; + font-size: 16px; + line-height: 125%; color: $copy-color-on-white; } ol { @@ -73,7 +77,7 @@ body.web.individual_jamtrack { list-style-type: disc; } li { - margin-left:20px; + margin-left: 20px; margin-bottom: 10px; } @@ -82,15 +86,15 @@ body.web.individual_jamtrack { padding-bottom: 40%; } .tab-and-return { - margin-top:20px; - font-size:12px; - color:$copy-color-on-white; + margin-top: 20px; + font-size: 12px; + color: $copy-color-on-white; } .search-area { - text-align:center; + text-align: center; a { color: $cta-color; - font-size:30px; + font-size: 30px; } } } @@ -105,78 +109,78 @@ body.web.individual_jamtrack { &.multi-para { p:nth-of-type(2) { - margin-bottom:20px; + margin-bottom: 20px; } } .video-wrapper { - margin-bottom:10px; + margin-bottom: 10px; &.bottomed { - margin-bottom:80px; + margin-bottom: 80px; } &.longbottomed { - margin-bottom:110px; + margin-bottom: 110px; } .cta-text { - color:$copy-color-on-dark; + color: $copy-color-on-dark; } } a { - color:blue; - text-decoration:underline; + color: blue; + text-decoration: underline; } .teacher-icons { - float:right; - max-width:250px; - margin-left:20px; + float: right; + max-width: 250px; + margin-left: 20px; .top-left { - margin-right:15px; - float:left; + margin-right: 15px; + float: left; } .top-right { - float:right; + float: right; } .bottom-left { - float:left; - margin-right:15px; + float: left; + margin-right: 15px; } .bottom-right { - float:right; + float: right; } .top-teacher-row { } .bottom-teacher-row { } .testdrive-note { - font-style:italic; - text-align:center; - margin-top:20px; + font-style: italic; + text-align: center; + margin-top: 20px; } } } .audio-wrapper { - float:left; - padding:10px 20px 20px; - text-align:center; - width:200px; + float: left; + padding: 10px 20px 20px; + text-align: center; + width: 200px; a { - display:inline-block; - margin-top:20px; + display: inline-block; + margin-top: 20px; color: $cta-color; - text-decoration:none; + text-decoration: none; } .sample-audio-text { - margin-top:3px; - text-align:center; + margin-top: 3px; + text-align: center; } .listening-note { - margin-top:20px; - font-style:italic; - font-size:12px; + margin-top: 20px; + font-style: italic; + font-size: 12px; } } @@ -191,12 +195,12 @@ body.web.individual_jamtrack { .video-wrapper { float: right; margin-left: 10px; - margin-bottom:80px; + margin-bottom: 80px; .cta-text { margin-left: 10px; - text-align:center; - margin-top:20px; + text-align: center; + margin-top: 20px; } &.left { float: left; @@ -211,7 +215,7 @@ body.web.individual_jamtrack { } .edit-link { - font-size:12px; + font-size: 12px; } .video-container { @@ -300,7 +304,7 @@ body.web.individual_jamtrack { } img.gift-card-preview { - width:300px; + width: 300px; float: left; margin-left: -15px; // because image has black on the left, which you can't see on back background margin-right: 20px; @@ -308,15 +312,15 @@ body.web.individual_jamtrack { } img.jam-class-teacher { - width:375px; - height:215px; - float:left; + width: 375px; + height: 215px; + float: left; margin-right: 20px; margin-bottom: 20px; } p.gift-getter { - margin-top:20px; - line-height:125%; + margin-top: 20px; + line-height: 125%; } img.app-preview { @@ -345,11 +349,11 @@ body.web.individual_jamtrack { } .cta-button { - cursor:pointer; + cursor: pointer; background-color: $cta-color; &.processing { - background-color:gray; + background-color: gray; } } @@ -378,15 +382,15 @@ body.web.individual_jamtrack { } .arrow1 { - position:absolute; + position: absolute; left: -371px; top: -80px; } .arrow2 { - position:absolute; - left:-230px; - top:373px; + position: absolute; + left: -230px; + top: 373px; } .arrow1-jamclass { @@ -396,30 +400,44 @@ body.web.individual_jamtrack { } .testimonials { - background-color:white; - position:absolute; - width:350px; - right:55px; - top:287px; + background-color: white; + position: absolute; + width: 350px; + right: 55px; + top: 287px; @include border_box_sizing; - z-index:1; + z-index: 1; + + &.jamtracks-affiliate { + top:597px; + h3 { + color: $cta-color; + } + } + + &.jamclass-affiliate { + top:1708px; + h3 { + color: $cta-color; + } + } &.jam-class { - top:557px; + top: 557px; h3 { - color:$cta-color; + color: $cta-color; } &.teachers { - top:618px; + top: 618px; } } .jamtrack-overview-video { h3 { - font-size:21px; - width:400px; + font-size: 21px; + width: 400px; } .video-wrapper { @@ -432,43 +450,43 @@ body.web.individual_jamtrack { } h3 { - color:$copy-color-on-white; - text-align:left; - margin-bottom:20px; - font-size:30px; - line-height:125%; + color: $copy-color-on-white; + text-align: left; + margin-bottom: 20px; + font-size: 30px; + line-height: 125%; } h4 { - position:absolute; + position: absolute; top: 161px; left: 173px; - font-size:14px; - color:$copy-color-on-white; + font-size: 14px; + color: $copy-color-on-white; strong { - font-weight:bold; + font-weight: bold; } - white-space:nowrap; + white-space: nowrap; } .testimonial { - position:relative; - width:350px; - margin-bottom:40px; + position: relative; + width: 350px; + margin-bottom: 40px; } .testimonial-speech-bubble { - width:350px; + width: 350px; } .testimonial-avatar { - width:60px; - position:relative; - top:5px; - left:92px; + width: 60px; + position: relative; + top: 5px; + left: 92px; } .testimonial-youtube { - width:143px; - position:relative; - left:112px; - top:0; + width: 143px; + position: relative; + left: 112px; + top: 0; } .testiminal-background { width: 200px; @@ -476,7 +494,7 @@ body.web.individual_jamtrack { left: 174px; top: 181px; font-size: 12px; - color:$copy-color-on-white; + color: $copy-color-on-white; } } .preview-and-action-box { @@ -492,7 +510,7 @@ body.web.individual_jamtrack { z-index: 1; &.jamclass { - top:209px; + top: 209px; } .preview-jamtrack-header { @@ -506,11 +524,11 @@ body.web.individual_jamtrack { border-color: $copy-color-on-dark; &.gift-card { - padding:20px 0 10px; + padding: 20px 0 10px; .jamtrack-title { - margin-top:10px; - font-size:18px; - font-style:italic; + margin-top: 10px; + font-size: 18px; + font-style: italic; } } @@ -525,8 +543,8 @@ body.web.individual_jamtrack { &.jam-class { border-width: 0 0 2px; p { - padding:8px 10px; - text-align:center; + padding: 8px 10px; + text-align: center; @include border_box_sizing; } } @@ -535,22 +553,22 @@ body.web.individual_jamtrack { border-color: $copy-color-on-dark; &.logged-in { - border-width:0; + border-width: 0; .tracks { - height:258px; + height: 258px; } } .tracks { - padding:10px 0 20px; - margin-top:10px; + padding: 10px 0 20px; + margin-top: 10px; overflow-y: scroll; height: 160px; - margin-bottom:10px; + margin-bottom: 10px; } .cta-buttons { - text-align:center; + text-align: center; } .cta-button { font-size: 24px; @@ -564,22 +582,22 @@ body.web.individual_jamtrack { font-family: Raleway, Arial, Helvetica, sans-serif; &.gift-card { - font-size:16px; - width:138px; - margin:15px 5px; - display:inline-block; + font-size: 16px; + width: 138px; + margin: 15px 5px; + display: inline-block; } } } .terms-help { - float:left; - margin-top:2px; - font-size:12px; + float: left; + margin-top: 2px; + font-size: 12px; } .register-area { &.jam-class { - padding:0; + padding: 0; } padding: 10px; input { @@ -588,15 +606,15 @@ body.web.individual_jamtrack { font-size: 16px; &[name="terms"] { - width:auto; - line-height:24px; - vertical-align:middle; + width: auto; + line-height: 24px; + vertical-align: middle; } } .icheckbox_minimal { float: left; top: 6px; - margin-left:64px; + margin-left: 64px; } .cta-button { font-size: 24px; @@ -618,9 +636,9 @@ body.web.individual_jamtrack { margin: 0 0 10px; } .errors { - font-size:12px; - height:20px; - margin:0; + font-size: 12px; + height: 20px; + margin: 0; visibility: hidden; text-align: center; color: red; @@ -639,10 +657,10 @@ body.web.individual_jamtrack { @include border-box_sizing; &.terms-help { - width:205px; - height:28px; - line-height:14px; - float:right; + width: 205px; + height: 28px; + line-height: 14px; + float: right; } } input { @@ -663,7 +681,7 @@ body.web.individual_jamtrack { .jam-track-preview-holder { margin-bottom: 7px; - float:left; + float: left; &[data-track-type="Master"] { width: 100%; } @@ -674,25 +692,33 @@ body.web.individual_jamtrack { } .jam-track-preview { - font-size:12px; + font-size: 12px; .instrument-part { - width:175px + width: 175px } - .instrument-name,.part { - display:none; + .instrument-name, .part { + display: none; } .loading-text { - right:-1px; - background-color:black; + right: -1px; + background-color: black; } } .price-advisory { - font-size:14px; - text-align:center; - color:white; - margin-top:10px; + font-size: 14px; + text-align: center; + color: white; + margin-top: 10px; + } + .affiliate-info-video.video-wrapper { + + .video-container { + width: 600px !important; + padding-bottom: 53.33%; + + } } } \ No newline at end of file diff --git a/web/app/controllers/api_users_controller.rb b/web/app/controllers/api_users_controller.rb index e4a398950..3413c9335 100644 --- a/web/app/controllers/api_users_controller.rb +++ b/web/app/controllers/api_users_controller.rb @@ -87,6 +87,8 @@ ApiUsersController < ApiController location: {:country => nil, :state => nil, :city => nil}, signup_hint: signup_hint, gift_card: params[:gift_card], + student: params[:student], + teacher: params[:teacher], affiliate_referral_id: cookies[:affiliate_visitor] } @@ -169,6 +171,8 @@ ApiUsersController < ApiController @user.update_online_presences(params[:online_presences]) if params.has_key?(:online_presences) @user.update_performance_samples(params[:performance_samples]) if params.has_key?(:performance_samples) @user.update_calendars(params[:calendars]) if params.has_key?(:calendars) + @user.is_a_student = params[:student] if params.has_key?(:student) + @user.is_a_teacher = params[:teacher] if params.has_key?(:teacher) @user.save if @user.errors.any? diff --git a/web/app/controllers/landings_controller.rb b/web/app/controllers/landings_controller.rb index 3cf423a07..798f050a1 100644 --- a/web/app/controllers/landings_controller.rb +++ b/web/app/controllers/landings_controller.rb @@ -85,6 +85,14 @@ class LandingsController < ApplicationController render 'jam_class_teachers', layout: 'web' end + def jam_class_affiliates + @olark_enabled = true + @no_landing_tag = true + @landing_tag_play_learn_earn = true + @show_after_black_bar_border = true + render 'jam_class_affiliates', layout: 'web' + end + def individual_jamtrack diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb index 2f2381a37..ee701ea83 100644 --- a/web/app/controllers/users_controller.rb +++ b/web/app/controllers/users_controller.rb @@ -219,7 +219,7 @@ class UsersController < ApplicationController @user = UserManager.new.signup_confirm(signup_token, request.remote_ip) if !@user.nil? && !@user.errors.any? - UserMailer.welcome_message(@user).deliver + #UserMailer.welcome_message(@user).deliver elsif !@user.nil? # new user with validation errors; logger.debug("#{@user} has errors. can not sign in until remedied. #{@user.errors.inspect}") diff --git a/web/app/views/landings/jam_class_affiliates.html.slim b/web/app/views/landings/jam_class_affiliates.html.slim new file mode 100644 index 000000000..94fe4d5f9 --- /dev/null +++ b/web/app/views/landings/jam_class_affiliates.html.slim @@ -0,0 +1,18 @@ +- provide(:page_name, 'landing_page full individual_jamtrack') +- provide(:description, @description) +- provide(:title, @title) + += react_component 'JamClassAffiliateLandingPage', @page_data.to_json + +- content_for :after_black_bar do + .row.cta-row + h2 SIGN UP AS AFFILIATE NOW, ITS FREE! + p And deliver more value to your customers while increasing revenue. + p.cta-text Not sure if the affiliate program is for you? Scroll down to learn more. + +- content_for :white_bar do + = react_component 'JamClassAffiliateLandingBottomPage', @page_data.to_json + +- content_for :red_bar do + .full-row + | Sign up for the JamKazam affiliate program today! \ No newline at end of file diff --git a/web/config/routes.rb b/web/config/routes.rb index 2638fcf93..1a83d235b 100644 --- a/web/config/routes.rb +++ b/web/config/routes.rb @@ -44,6 +44,7 @@ SampleApp::Application.routes.draw do match '/landing/gift-card', to: 'landings#buy_gift_card', via: :get, as: 'buy_gift_card' match '/landing/jamclass/students', to: 'landings#jam_class_students', via: :get match '/landing/jamclass/teachers', to: 'landings#jam_class_teachers', via: :get + match '/landing/jamclass/affiliates', to: 'landings#jam_class_affiliates', via: :get match '/affiliateProgram', to: 'landings#affiliate_program', via: :get, as: 'affiliate_program' diff --git a/web/lib/user_manager.rb b/web/lib/user_manager.rb index 5fd12f487..ca00ef307 100644 --- a/web/lib/user_manager.rb +++ b/web/lib/user_manager.rb @@ -30,6 +30,8 @@ class UserManager < BaseManager signup_hint = options[:signup_hint] affiliate_partner = options[:affiliate_partner] gift_card = options[:gift_card] + student = options[:student] + teacher = options[:teacher] recaptcha_failed = false unless options[:skip_recaptcha] # allow callers to opt-of recaptcha @@ -74,7 +76,9 @@ class UserManager < BaseManager any_user: any_user, signup_hint: signup_hint, affiliate_partner: affiliate_partner, - gift_card: gift_card) + gift_card: gift_card, + student: student, + teacher: teacher) user end diff --git a/web/spec/features/student_landing_spec.rb b/web/spec/features/student_landing_spec.rb new file mode 100644 index 000000000..ed2852b6d --- /dev/null +++ b/web/spec/features/student_landing_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +describe "Student Landing", :js => true, :type => :feature, :capybara_feature => true do + + subject { page } + + before(:all) do + ShoppingCart.delete_all + JamTrackRight.delete_all + JamTrack.delete_all + JamTrackTrack.delete_all + JamTrackLicensor.delete_all + end + + + let(:user) { FactoryGirl.create(:user, country: 'US') } + + + it "logged out" do + visit "/landing/jamclass/students" + + find('h1.jam-track-name', 'JAMCLASS') + find('h2.original-artist', 'Finally, online music lessons that really work!') + + find('button.cta-button', text: 'SIGN UP').trigger(:click) + + # should fail because we haven't filled out email/password/terms + find('.register-area .errors', text: "Email can't be blank") + + fill_in "email", with: 'student_123@jamkazam.com' + fill_in "password", with: 'jam123' + find('.register-area ins', visible: false) .trigger(:click) + find('button.cta-button', text: 'SIGN UP').trigger(:click) + + # this should show on the /client#/home page (WILL CHANGE) + find('h2', text: 'create session') + + user = User.find_by_email('student_123@jamkazam.com') + user.is_a_student.should be true + user.is_a_teacher.should be false + user.musician.should be true + end + + it "logged in" do + fast_signin(user,"/landing/jamclass/students") + + find('h1.jam-track-name', 'JAMCLASS') + find('h2.original-artist', 'Finally, online music lessons that really work!') + + find('button.cta-button', text: 'TRY TESTDRIVE').trigger(:click) + + # this should show on the /client#/home page (WILL CHANGE) + find('h2', text: 'create session') + + user.reload + user.is_a_student.should be true + user.is_a_teacher.should be false + user.musician.should be true + end + +end diff --git a/web/spec/features/teacher_landing_spec.rb b/web/spec/features/teacher_landing_spec.rb new file mode 100644 index 000000000..85a4853e7 --- /dev/null +++ b/web/spec/features/teacher_landing_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +describe "Student Landing", :js => true, :type => :feature, :capybara_feature => true do + + subject { page } + + before(:all) do + ShoppingCart.delete_all + JamTrackRight.delete_all + JamTrack.delete_all + JamTrackTrack.delete_all + JamTrackLicensor.delete_all + end + + + let(:user) { FactoryGirl.create(:user, country: 'US') } + + + it "logged out" do + visit "/landing/jamclass/teachers" + + find('h1.jam-track-name', 'JAMCLASS') + find('h2.original-artist', 'Finally, online music lessons that really work!') + + find('button.cta-button', text: 'SIGN UP').trigger(:click) + + # should fail because we haven't filled out email/password/terms + find('.register-area .errors', text: "Email can't be blank") + + fill_in "email", with: 'teacher_123@jamkazam.com' + fill_in "password", with: 'jam123' + find('.register-area ins', visible: false).trigger(:click) + find('button.cta-button', text: 'SIGN UP').trigger(:click) + + # this should show on the /client#/home page (WILL CHANGE) + find('h2', text: 'create session') + + user = User.find_by_email('teacher_123@jamkazam.com') + user.is_a_student.should be false + user.is_a_teacher.should be true + user.musician.should be true + end + + it "logged in" do + fast_signin(user,"/landing/jamclass/teachers") + + find('h1.jam-track-name', 'JAMCLASS') + find('h2.original-artist', 'Finally, online music lessons that really work!') + + find('button.cta-button', text: 'BECOME A TEACHER').trigger(:click) + + # this should show on the /client#/home page (WILL CHANGE) + find('h2', text: 'create session') + + user.reload + user.is_a_student.should be false + user.is_a_teacher.should be true + user.musician.should be true + end + +end diff --git a/web/spec/managers/user_manager_spec.rb b/web/spec/managers/user_manager_spec.rb index b0747dac4..cf96ae73e 100644 --- a/web/spec/managers/user_manager_spec.rb +++ b/web/spec/managers/user_manager_spec.rb @@ -4,14 +4,14 @@ require 'spec_helper' describe UserManager do before(:each) do - Rails.application.config.recaptcha_enable=false + Rails.application.config.recaptcha_enable=false @user_manager = UserManager.new(:conn => @conn) UserMailer.deliveries.clear - @location = { :country => "US", :state => "Arkansas", :city => "Little Rock" } - @loca = { :country => "US", :state => "Arkansas", :city => "Texarkana" } - @locb = { :country => "US", :state => "Texas", :city => "Longview" } - @locc = { } - @instruments = [ { :instrument_id=>"electric guitar", :proficiency_level => '1', :priority=>0 }] + @location = {:country => "US", :state => "Arkansas", :city => "Little Rock"} + @loca = {:country => "US", :state => "Arkansas", :city => "Texarkana"} + @locb = {:country => "US", :state => "Texas", :city => "Longview"} + @locc = {} + @instruments = [{:instrument_id => "electric guitar", :proficiency_level => '1', :priority => 0}] end describe 'better signup' do @@ -181,24 +181,24 @@ describe UserManager do describe "signup" do let!(:user) { FactoryGirl.create(:user) } - let!(:partner) { - AffiliatePartner.create_with_web_params(user, {:partner_name => Faker::Company.name, entity_type:'Individual'}) + let!(:partner) { + AffiliatePartner.create_with_web_params(user, {:partner_name => Faker::Company.name, entity_type: 'Individual'}) } it "signup successfully" do GeoIpLocations.delete_all # prove that city/state/country will remain nil if no maxmind data user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman1@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician:true, - signup_confirm_url: "http://localhost:3000/confirm", - affiliate_referral_id: partner.id) + first_name: "bob", + last_name: "smith", + email: "userman1@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm", + affiliate_referral_id: partner.id) user.errors.any?.should be_false user.first_name.should == "bob" @@ -220,15 +220,15 @@ describe UserManager do it "signup successfully with instruments" do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman2@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: "userman2@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.instruments.length.should == 1 @@ -239,14 +239,14 @@ describe UserManager do it "doesnt fail if ip address is nil" do user = @user_manager.signup(first_name: "bob", - last_name: "smith", - email: "userman3@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm" ) + last_name: "smith", + email: "userman3@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.city.should be_nil @@ -257,15 +257,15 @@ describe UserManager do it "sets the location properly from maxmind" do MaxMindManager.create_phony_database user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman4@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm" ) + first_name: "bob", + last_name: "smith", + email: "userman4@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.city.should == 'Boston' @@ -276,16 +276,16 @@ describe UserManager do it "accepts location if specified" do MaxMindManager.create_phony_database user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman5@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - location: @location, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm" ) + first_name: "bob", + last_name: "smith", + email: "userman5@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + location: @location, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.city.should == 'Little Rock' @@ -296,16 +296,16 @@ describe UserManager do it "accepts a nil location, if specified" do MaxMindManager.create_phony_database user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman6@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - location: {}, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm" ) + first_name: "bob", + last_name: "smith", + email: "userman6@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + location: {}, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.city.should be_nil @@ -317,16 +317,16 @@ describe UserManager do it "accepts birth_date if specified" do MaxMindManager.create_phony_database user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman7@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - birth_date: Date.new(2001, 1, 1), - musician: true, - signup_confirm_url: "http://localhost:3000/confirm" ) + first_name: "bob", + last_name: "smith", + email: "userman7@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + birth_date: Date.new(2001, 1, 1), + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.birth_date.should == Date.new(2001, 1, 1) @@ -335,62 +335,62 @@ describe UserManager do it "duplicate signup failure" do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman8@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: "userman8@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") UserMailer.deliveries.length.should == 1 user.errors.any?.should be_false # exactly the same parameters; should dup on email, and send no email user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman8@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: "userman8@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") UserMailer.deliveries.length.should == 1 user.errors.any?.should be_true user.errors[:email][0].should == "has already been taken" end - it "fail on no first_name/last_name" do + it "is OK with no first_name/last_name" do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "", - last_name: "", - email: "userman10@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm") - UserMailer.deliveries.length.should == 0 - user.errors.any?.should be_true - user.errors[:first_name][0].should == "can't be blank" + first_name: "", + last_name: "", + email: "userman10@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") + UserMailer.deliveries.length.should == 1 + user.errors.any?.should be_false + user.name.should eq 'Anonymous' end it "fail on no email" do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "murp", - last_name: "blurp", - email: "", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "murp", + last_name: "blurp", + email: "", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") UserMailer.deliveries.length.should == 0 user.errors.any?.should be_true @@ -401,22 +401,22 @@ describe UserManager do describe "signup_confirm" do it "fail on no username" do - user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman11@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - signup_confirm_url: "http://localhost:3000/confirm") - user = @user_manager.signup_confirm(user.signup_token) - user.email_confirmed.should be_true + user = @user_manager.signup(remote_ip: "127.0.0.1", + first_name: "bob", + last_name: "smith", + email: "userman11@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + signup_confirm_url: "http://localhost:3000/confirm") + user = @user_manager.signup_confirm(user.signup_token) + user.email_confirmed.should be_true end it "fail to confirm bogus signup_confirmnup token" do - @user_manager.signup_confirm("murp").should be_nil + @user_manager.signup_confirm("murp").should be_nil end it "fail to confirm empty signup token" do @@ -437,16 +437,16 @@ describe UserManager do invitation.accepted.should be_false user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: invitation.email, - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - invited_user: invitation, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: invitation.email, + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + invited_user: invitation, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.email_confirmed.should be_true @@ -466,16 +466,16 @@ describe UserManager do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: invitation.email, - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - invited_user: invitation, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: invitation.email, + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + invited_user: invitation, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.email_confirmed.should be_true @@ -495,16 +495,16 @@ describe UserManager do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: invitation.email, - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - invited_user: invitation, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: invitation.email, + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + invited_user: invitation, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.email_confirmed.should be_true @@ -526,16 +526,16 @@ describe UserManager do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman12@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - invited_user: invitation, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: "userman12@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + invited_user: invitation, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.email_confirmed.should be_false @@ -555,16 +555,16 @@ describe UserManager do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: fb_signup.email, - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - fb_signup: fb_signup, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: fb_signup.email, + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + fb_signup: fb_signup, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.email_confirmed.should be_true @@ -584,16 +584,16 @@ describe UserManager do user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman13@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - fb_signup: fb_signup, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: "userman13@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + fb_signup: fb_signup, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_false user.email_confirmed.should be_false @@ -616,16 +616,16 @@ describe UserManager do UserMailer.deliveries.clear user = @user_manager.signup(remote_ip: "127.0.0.1", - first_name: "bob", - last_name: "smith", - email: "userman13@jamkazam.com", - password: "foobar", - password_confirmation: "foobar", - terms_of_service: true, - instruments: @instruments, - musician: true, - fb_signup: fb_signup, - signup_confirm_url: "http://localhost:3000/confirm") + first_name: "bob", + last_name: "smith", + email: "userman13@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + musician: true, + fb_signup: fb_signup, + signup_confirm_url: "http://localhost:3000/confirm") user.errors.any?.should be_true user.errors[:user_authorizations].should == ['is invalid'] @@ -656,10 +656,10 @@ describe UserManager do location: @loca, recaptcha_failed: true, signup_confirm_url: "http://localhost:3000/confirm") - user.errors.any?.should be_false + user.errors.any?.should be_false end # it "passes even with true recaptcha" end # describe "without nocaptcha" - + describe "with nocaptcha" do before(:each) do @old_recaptcha=Rails.application.config.recaptcha_enable @@ -671,7 +671,7 @@ describe UserManager do Rails.application.config.recaptcha_enable=@old_recaptcha end - it "fails when nocaptcha fails" do + it "fails when nocaptcha fails" do user = @user_manager.signup(remote_ip: "1.2.3.4", first_name: "bob", last_name: "smith", @@ -685,7 +685,7 @@ describe UserManager do recaptcha_response: nil, signup_confirm_url: "http://localhost:3000/confirm") - user.errors.any?.should be_true + user.errors.any?.should be_true UserMailer.deliveries.should have(0).items end @@ -704,13 +704,96 @@ describe UserManager do location: @loca, signup_confirm_url: "http://localhost:3000/confirm") - user.errors.any?.should be_false + user.errors.any?.should be_false end # it "passes when facebook signup" end # describe "with nocaptcha" + describe "student/teacher" do + it "accepts student" do + user = @user_manager.signup(remote_ip: "1.2.3.4", + first_name: "bob", + last_name: "smith", + email: "student1@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + location: @loca, + student: true, + signup_confirm_url: "http://localhost:3000/confirm") + UserMailer.deliveries.length.should == 1 + user.errors.any?.should be_false + user = User.find(user.id) + user.has_redeemable_jamtrack.should be_true + user.is_a_student.should be_true + user.is_a_teacher.should be_false + user.musician.should be_true + end + + it "accepts teacher" do + user = @user_manager.signup(remote_ip: "1.2.3.4", + first_name: "bob", + last_name: "smith", + email: "student2@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + location: @loca, + teacher: true, + signup_confirm_url: "http://localhost:3000/confirm") + UserMailer.deliveries.length.should == 1 + user.errors.any?.should be_false + user = User.find(user.id) + user.has_redeemable_jamtrack.should be_true + user.is_a_student.should be_false + user.is_a_teacher.should be_true + user.musician.should be_true + end + + it "accepts teacher and student" do + user = @user_manager.signup(remote_ip: "1.2.3.4", + first_name: "bob", + last_name: "smith", + email: "student3@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + instruments: @instruments, + location: @loca, + teacher: true, + signup_confirm_url: "http://localhost:3000/confirm") + UserMailer.deliveries.length.should == 1 + user.errors.any?.should be_false + user = User.find(user.id) + user.has_redeemable_jamtrack.should be_true + user.is_a_student.should be_false + user.is_a_teacher.should be_true + user.musician.should be_true + end + + it "lets user be a fan if nothing if musician/student/teacher is true" do + user = @user_manager.signup(remote_ip: "1.2.3.4", + first_name: "bob", + last_name: "smith", + email: "student4@jamkazam.com", + password: "foobar", + password_confirmation: "foobar", + terms_of_service: true, + location: @loca, + signup_confirm_url: "http://localhost:3000/confirm") + UserMailer.deliveries.length.should == 1 + user.errors.any?.should be_false + user = User.find(user.id) + user.has_redeemable_jamtrack.should be_true + user.is_a_student.should be_false + user.is_a_teacher.should be_false + user.musician.should be_false + end + end describe "gift_card" do - let(:gift_card) {FactoryGirl.create(:gift_card)} + let(:gift_card) { FactoryGirl.create(:gift_card) } it "can succeed when specified" do user = @user_manager.signup(remote_ip: "1.2.3.4",