Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop

This commit is contained in:
Peter Walker 2017-10-15 20:17:59 -05:00
commit e56e07e6d9
28 changed files with 982 additions and 23 deletions

View File

@ -10,14 +10,15 @@ ActiveAdmin.register_page "POSA Card Uploads" do
file = params[:jam_ruby_posa_card][:csv]
array_of_arrays = CSV.read(file.tempfile.path)
array_of_arrays.each do |row|
if row.length != 4
raise "UKNONWN CSV FORMAT! Must be 4 columns"
if row.length != 5
raise "UKNONWN CSV FORMAT! Must be 5 columns"
end
code = row[0]
lesson_package_type = row[1]
preactivate = row[2].strip == "true"
requires_purchase = row[3].strip == "true"
preactivate = row[2].strip.downcase == "true"
requires_purchase = row[3].downcase== "true"
is_test = row[4].strip.downcase == "true"
posa_card = PosaCard.new
posa_card.code = code
@ -26,6 +27,7 @@ ActiveAdmin.register_page "POSA Card Uploads" do
posa_card.requires_purchase = requires_purchase
posa_card.purchased = !requires_purchase
posa_card.card_type = params[:jam_ruby_posa_card][:card_type]
posa_card.is_test = is_test
if posa_card.card_type == PosaCard::JAM_CLASS_4

View File

@ -377,4 +377,5 @@ guitar_center_integration_v1.sql
mobile_recording_support.sql
youtube_broadcast.sql
amazon_v1.sql
sms_index_optimize.sql
sms_index_optimize.sql
amazon_signup.sql

3
db/up/amazon_signup.sql Normal file
View File

@ -0,0 +1,3 @@
ALTER TABLE users ADD COLUMN under_13 BOOLEAN;
ALTER TABLE users ADD COLUMN via_amazon BOOLEAN;
ALTER TABLE posa_cards ADD COLUMN is_test BOOLEAN DEFAULT FALSE;

View File

@ -202,6 +202,8 @@ $$ LANGUAGE plpgsql;
-- CREATE INDEX index_music_sessions_on_create_type ON music_sessions USING btree(create_type);
-- CREATE INDEX index_music_sessions_on_scheduled_start ON music_sessions USING btree(scheduled_start);
-- CREATE INDEX index_music_sessions_on_canceled ON music_sessions USING btree(canceled);
-- CREATE INDEX index_music_sessions_on_session_removed_at ON music_sessions USING btree(session_removed_at);
-- CREATE INDEX index_music_sessions_on_started_at ON music_sessions USING btree(started_at);
-- update music_sessions set canceled = true WHERE (scheduled_start IS NULL OR scheduled_start > (NOW() - (interval '15 minute'))) AND canceled = FALSE AND description != 'Jam Track Session' AND id NOT IN (SELECT id FROM active_music_sessions) AND id NOT IN (select distinct on(name, user_id) id FROM music_sessions WHERE (scheduled_start IS NULL OR scheduled_start > (NOW() - (interval '15 minute'))) AND canceled = FALSE AND description != 'Jam Track Session' AND id NOT IN (SELECT id FROM active_music_sessions) order by name, user_id);
@ -211,4 +213,27 @@ $$ LANGUAGE plpgsql;
-- select distinct on(name, user_id) name, description, scheduled_start FROM music_sessions WHERE (scheduled_start IS NULL OR scheduled_start > (NOW() - (interval '15 minute'))) AND canceled = FALSE AND description != 'Jam Track Session' AND id NOT IN (SELECT id FROM active_music_sessions) order by name, user_id;
-- get count
-- SELECT count(id) FROM music_sessions WHERE (scheduled_start IS NULL OR scheduled_start > (NOW() - (interval '15 minute'))) AND canceled = FALSE AND description != 'Jam Track Session' AND id NOT IN (SELECT id FROM active_music_sessions)
-- SELECT count(id) FROM music_sessions WHERE (scheduled_start IS NULL OR scheduled_start > (NOW() - (interval '15 minute'))) AND canceled = FALSE AND description != 'Jam Track Session' AND id NOT IN (SELECT id FROM active_music_sessions)
SELECT distinct music_sessions.* FROM "music_sessions" LEFT OUTER JOIN
rsvp_slots
ON
music_sessions.id = rsvp_slots.music_session_id AND (music_sessions.canceled = FALSE)
LEFT OUTER JOIN
rsvp_requests_rsvp_slots
ON
rsvp_requests_rsvp_slots.rsvp_slot_id = rsvp_slots.id
LEFT OUTER JOIN
rsvp_requests
ON rsvp_requests.id = rsvp_requests_rsvp_slots.rsvp_request_id
LEFT OUTER JOIN
invitations
ON
music_sessions.id = invitations.music_session_id AND invitations.receiver_id = 'aedab51a-14cd-46d1-9828-29eadddd1f53'
WHERE
(music_sessions.scheduled_start IS NULL OR (music_sessions.scheduled_start > NOW() - '12 hour'::INTERVAL AND music_sessions.started_at IS NULL) OR (music_sessions.session_removed_at > NOW() - '2 hour'::INTERVAL) OR (music_sessions.started_at IS NOT NULL AND music_sessions.session_removed_at IS NULL)) AND (music_sessions.create_type IS NULL OR (music_sessions.create_type != 'quick-start' AND music_sessions.create_type != 'quick-public')) AND
((rsvp_requests.id IS NOT NULL AND rsvp_requests_rsvp_slots.id IS NOT NULL AND rsvp_requests.user_id = 'aedab51a-14cd-46d1-9828-29eadddd1f53' AND rsvp_requests_rsvp_slots.chosen = true) OR (invitations.id IS NOT NULL) OR (music_sessions.user_id = 'aedab51a-14cd-46d1-9828-29eadddd1f53') ) ORDER BY music_sessions.scheduled_start ASC;

View File

@ -66,6 +66,22 @@ module JamRuby
end
end
def amazon_welcome_message(user)
@user = user
@subject = "Your 2 free music lessons"
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 => @subject) do |format|
format.text
format.html
end
end
def student_welcome_message(user)
@user = user
@subject = "Welcome to JamKazam and JamClass online lessons!"

View File

@ -0,0 +1,18 @@
<p>
Welcome to JamKazam, and congratulations on the purchase of your new guitar or bass from Amazon!
</p>
<p>
Connecting with a world-class instructor is the best way to learn to play an instrument. Your instructor will guide you based on your unique goals, make sure youre doing things correctly to build a solid foundation, and maximize your musical growth from your investment of time.
</p>
<p>JamKazam has attracted a community of world-class instructors and has built a truly unique technology platform that lets students and instructors learn and play together over the Internet from the comfort and convenience of home.</p>
<p>
Within a day or two, one of our support team members will reach out to you via email to help you get ready for your first lesson. We provide free and highly personalized 1:1 support to help you set up our app with audio and video, make sure everything is working properly, and get you comfortable with the features youll be using in your lessons.
</p>
<p>
Thanks again for joining our community of <%= APP_CONFIG.musician_count %> musicians and starting your musical journey with us! Well be in touch very soon.
</p>
<p>Best Regards,<br/>
Team JamKazam</p>

View File

@ -0,0 +1,14 @@
<% provide(:title, @subject) %>
Welcome to JamKazam, and congratulations on the purchase of your new guitar or bass from Amazon!
Connecting with a world-class instructor is the best way to learn to play an instrument. Your instructor will guide you based on your unique goals, make sure youre doing things correctly to build a solid foundation, and maximize your musical growth from your investment of time.
JamKazam has attracted a community of world-class instructors and has built a truly unique technology platform that lets students and instructors learn and play together over the Internet from the comfort and convenience of home.</p>
Within a day or two, one of our support team members will reach out to you via email to help you get ready for your first lesson. We provide free and highly personalized 1:1 support to help you set up our app with audio and video, make sure everything is working properly, and get you comfortable with the features youll be using in your lessons.
Thanks again for joining our community of <%= APP_CONFIG.musician_count %> musicians and starting your musical journey with us! Well be in touch very soon.
Best Regards,
Team JamKazam

View File

@ -17,6 +17,7 @@ module JamRuby
AMAZON_TEST_DRIVE_FREE_2_ID = 'amazon-test-drive-free-2'
AMAZON_TEST_DRIVE_FREE_4_ID = 'amazon-test-drive-free-4'
AMAZON_PACKAGES = [AMAZON_TEST_DRIVE_4_PAID_ID, AMAZON_TEST_DRIVE_FREE_2_ID, AMAZON_TEST_DRIVE_FREE_4_ID]
LESSON_PACKAGE_TYPES =
[
SINGLE_FREE,
@ -47,6 +48,10 @@ module JamRuby
LessonPackageType.find(SINGLE_FREE)
end
def is_amazon?
AMAZON_PACKAGES.include?(id)
end
def self.amazon_test_drive_free_4
LessonPackageType.find(AMAZON_TEST_DRIVE_FREE_4_ID)
end

View File

@ -38,10 +38,16 @@ module JamRuby
validate :must_be_activated
validate :within_one_year
def is_amazon_posa_card?
lesson_package_type.is_amazon?
end
def is_lesson_posa_card?
self.is_lesson
end
def self.find_by_amazon_code(code)
PosaCard.where('code ilike ?', code).where('lesson_package_type_id in (?)', LessonPackageType::AMAZON_PACKAGES).first
end
def already_activated
if activated_at && activated_at_was && activated_at_changed?

View File

@ -1166,6 +1166,7 @@ module JamRuby
education_interest = options[:education_interest]
origin = options[:origin]
test_drive_package_details = options[:test_drive_package]
under_13 = options[:under_13]
test_drive_package = TestDrivePackage.find_by_name(test_drive_package_details[:name]) if test_drive_package_details
@ -1204,6 +1205,7 @@ module JamRuby
user.gifted_jamtracks = 0
user.jamclass_credits = 0
user.has_redeemable_jamtrack = true
user.under_13 = under_13
user.is_a_student = !!student
user.is_a_teacher = !!teacher
user.retailer_interest = !!retailer_interest
@ -1365,6 +1367,7 @@ module JamRuby
if posa_card
posa_card.claim(user)
user.via_amazon = posa_card.is_amazon_posa_card?
user.posa_cards << posa_card
user.purchase_required = posa_card.requires_purchase # temporary; just so the signup page knows to send them to payment place
else
@ -1464,8 +1467,14 @@ module JamRuby
body << " Code: #{posa_card.code}\n"
end
AdminMailer.jamclass_alerts({subject: "#{user.name} just signed up as a student", body: body}).deliver_now
UserMailer.student_welcome_message(user).deliver_now
AdminMailer.jamclass_alerts({subject: "#{user.email} just signed up as a student", body: body}).deliver_now
if user.via_amazon
UserMailer.amazon_welcome_message(user).deliver_now
else
UserMailer.student_welcome_message(user).deliver_now
end
#end
elsif user.is_a_teacher
UserMailer.teacher_welcome_message(user).deliver_now

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -292,10 +292,15 @@
}, 0)
}
function setActive(active) {
if(context.UserActivityActions) {
context.UserActivityActions.setActive(active)
}
}
function markAway() {
logger.debug("sleep again!")
active = false;
context.UserActivityActions.setActive(active)
setActive(active)
var userStatus = msg_factory.userStatus(false, null);
server.send(userStatus);
}
@ -303,7 +308,7 @@
function activityCheck() {
var timeoutTime = 300000; // 5 * 1000 * 60 , 5 minutes
active = true;
context.UserActivityActions.setActive(active)
setActive(active)
activityTimeout = setTimeout(markAway, timeoutTime);
$(document).ready(function() {
$('body').bind('mousedown keydown touchstart focus', function(event) {
@ -320,7 +325,7 @@
}
}
active = true;
context.UserActivityActions.setActive(active)
setActive(active)
activityTimeout = setTimeout(markAway, timeoutTime);
});
});

View File

@ -0,0 +1,19 @@
//= require bluebird
//= require babel/polyfill
//= require bugsnag
//= require bind-polyfill
//= require jquery
//= require jquery.monkeypatch
//= require jquery_ujs
//= require jquery.cookie
//= require AAC_underscore
//= require AAA_Log
//= require globals
//= require AAB_message_factory
//= require jam_rest
//= require ga
//= require layout
//= require jamkazam
//= require utils
//= require JamServer
//= require everywhere/everywhere

View File

@ -0,0 +1,459 @@
/**
*= require client/jamServer
*= require client/jamServer
*= require dialogs/banner
*/
$base-font-family: 'arial', sans-serif;
$standard-font-size: 1rem;
$smaller-font-size: .8rem;
$small-font-size: .7rem;
$input-font-size: 1.0rem;
$amazon-btn-line-height:160%;
$submit-button-width:9rem;
$checkbox-label-width:14rem;
$create-account-width:10rem;
html,
body {
min-height: 100%;
overflow:auto;
}
body {
min-height: 100%;
margin: 0;
padding: 0;
font-size: 16px;
line-height: 1.2;
}
#basic-container {
width: 100%;
min-height: 100%;
}
.wrapper {
width: 100%;
min-height: 100%;
}
html {
font-size: 100%;
}
@media (min-width:1px) and (max-width: 1199px) {
html {
font-size: 100%;
}
.code-input {
max-width:$submit-button-width;
}
.code-input input {
font-size: $standard-font-size;
}
.code-instructions {
width:$submit-button-width;
}
.text-input input {
width:$create-account-width;
}
.instructions.create-account {
margin-top:1rem;
}
.success-msg {
margin-top: 1rem;
}
.logo-holder.create-account {
margin-top:2rem;
}
.code-form.create-account {
margin-top:1rem;
}
.powered-by.create-account {
margin-top:0.5rem;
}
}
@media (min-width: 1200px) {
html {
font-size: 100%;
}
.code-input {
max-width:$submit-button-width;
}
.code-input input {
font-size: $standard-font-size;
}
.code-instructions {
width: 35%;
}
.text-input input {
width:$create-account-width;
}
.success-msg {
margin-top: 2rem;
}
}
body {
font-family: $base-font-family;
}
p {
margin:.5rem 0;
}
p:first-child {
margin-top:0;
}
p.last-child {
margin-bottom:0;
}
#root {
min-height: 100%;
align-items: center;
//justify-content: center;
min-width: 50%;
display: flex;
flex-direction: column;
}
div.root {
flex-grow: 1;
overflow: auto;
}
.logo-holder {
margin-top:3rem;
display: flex;
align-items: center;
flex-direction: column;
width: 50%;
max-width: 300px;
min-width:0;
min-height:0;
img {
width: 100%;
}
}
.steps {
margin-top: 1rem;
display: flex;
align-items: center;
flex-direction: column;
width: 35%;
max-width: 200px;
img {
width: 100%;
}
}
.instructions {
font-size: $standard-font-size;
margin-top: 2rem;
display: flex;
align-items: center;
flex-direction: column;
width: 90%;
max-width: 400px;
text-align: center;
}
.code-form {
font-size: $standard-font-size;
margin-top: 2rem;
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 1200px;
text-align: center;
}
.code-prompt {
position: absolute;
text-align: right;
font-size: $smaller-font-size;
height:$standard-font-size * 2;
line-height:$standard-font-size * 2;
}
label.promo-code {
width: 6rem;
margin-left:-6.5rem;
}
.code-input {
width: 100%;
position:relative;
input {
font-size: $input-font-size;
text-transform: uppercase;
padding: 6px 3px;
box-sizing: border-box;
text-align: center;
border-radius:3px;
border-width:2px;
min-width:$submit-button-width;
color:#555;
font-weight:bold;
width:100%;
}
}
.code-hint-row {
font-size: $standard-font-size;
margin-top: .1rem;
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 1200px;
text-align: center;
}
.code-instructions {
font-size: $small-font-size;
}
.submit-row {
font-size: $standard-font-size;
margin-top: 2rem;
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 1200px;
text-align: center;
&.create-account {
margin-top:1rem;
}
}
.submit {
color: #111;
text-decoration: none;
background-color: transparent;
border: 0;
display: block;
font-size: $standard-font-size;
line-height: $amazon-btn-line-height;
outline: 0;
text-align: center;
white-space: nowrap;
&.submit-code {
width:$submit-button-width;
}
&.create-account {
width: $create-account-width;
}
}
.amazon-a-button-text {
width: 100%;
height: 100%;
background-color: transparent;
border: 0;
display: block;
font-size: $standard-font-size;
line-height: $amazon-btn-line-height;
margin: 0;
outline: 0;
padding: 0 10px 0 11px;
text-align: center;
white-space: nowrap;
box-sizing: border-box;
}
.amazon-button-stack {
}
.amazon-button {
width: 100%;
background: #f0c14b;
border-color: #a88734 #9c7e31 #846a29;
color: #111;
border-radius: 3px;
border-style: solid;
border-width: 1px;
cursor: pointer;
display: inline-block;
padding: 0;
text-align: center;
text-decoration: none !important;
vertical-align: middle;
box-sizing: border-box;;
&:hover {
border-color: darken(#a88734, 10%) darken(#9c7e31, 10%) darken(#846a29, 10%) ;
}
&:active {
border-color: #e77600;
box-shadow: 0 0 3px 2px rgba(2281, 121, 17, .5);
}
}
.amazon-button-inner {
display: block;
position: relative;
overflow: hidden;
height: $amazon-btn-line-height;
box-shadow: 0 1px 0 rgba(255, 255, 255, .4) inset;
border-radius: 2px;
background: linear-gradient(to bottom, #f7dfa5, #f0c14b);
&:hover {
background: linear-gradient(to bottom, darken(#f7dfa5, 7%), #f0c14b);
}
&:active {
background: #f0c14b;
}
}
.powered-by {
font-size: $smaller-font-size;
margin-top: 1.5rem;
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 1200px;
text-align: center;
.code-prompt {
width:24%;
}
p {
width: 55%;
max-width: 600px;
}
img {
width: 6rem;
margin-left: 1px;
vertical-align: middle;
}
}
/** step 2 */
.success-msg {
display: flex;
align-items: center;
flex-direction: column;
width: 85%;
font-weight:bold;
white-space: nowrap;
text-align:center;
}
.password-row {
font-size: $standard-font-size;
margin-top: 1rem;
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 1200px;
text-align: center;
}
.terms-row, .under13-row {
font-size: $standard-font-size;
margin-top: 1rem;
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 1200px;
text-align: center;
}
.under13-row {
margin-top:.5rem;
}
.text-input {
width:$create-account-width;
max-width: 400px;
position:relative;
input {
font-size: $input-font-size;
padding: 6px 3px;
box-sizing: border-box;
text-align: left;
border-radius:3px;
border-width:2px;
}
}
input[type=submit] {
display:none;
}
.checkbox-input {
font-size:$small-font-size;
width:$create-account-width;
/**display:flex;
align-items: flex-start;
flex-direction: row;
*/
input {
float:left;
margin-bottom:1rem;
}
label {
min-width:$checkbox-label-width;
display:block;
text-align:left;
a{
white-space: nowrap;
}
}
}
label.email {
width:6rem;
margin-left:-6.5rem;
}
label.password {
width:8rem;
margin-left:-8.5rem;
}
.error {
color:red;
//text-transform: uppercase;
width:100%;
position:absolute;
margin-top:-$standard-font-size * 1.2;
white-space: nowrap;
}

View File

@ -89,7 +89,7 @@ class LandingsController < ApplicationController
teachers = []
package.test_drive_package_teachers.each do |package_teacher|
teacher = package_teacher.user
teachers.push({id: teacher.id, name: teacher.name, first_name: teacher.first_name,last_name: teacher.last_name, biography: teacher.teacher.short_bio, photo_url: teacher.photo_url})
teachers.push({id: teacher.id, name: teacher.name, first_name: teacher.first_name, last_name: teacher.last_name, biography: teacher.teacher.short_bio, photo_url: teacher.photo_url})
end
package_data[:teachers] = teachers
@ -168,7 +168,7 @@ class LandingsController < ApplicationController
instrument = params[:instrument].downcase.sub('-', ' ')
instrument = Instrument.find_by_id(instrument)
instrument_id = instrument.id if instrument
instrument_name = instrument .description
instrument_name = instrument.description
query, next_ptr, instrument_count = JamTrack.index({instrument: instrument_id}, current_user)
end
@jam_track = JamTrack.find_by_slug(params[:plan_code])
@ -192,7 +192,6 @@ class LandingsController < ApplicationController
end
def individual_jamtrack_band
enable_olark
@no_landing_tag = true
@ -387,7 +386,7 @@ class LandingsController < ApplicationController
end
@page_data = {school: @school, invitation_code: params[:invitation_code], defaultEmail: defaultEmail, preview: @preview}
@page_data = {school: @school, invitation_code: params[:invitation_code], defaultEmail: defaultEmail, preview: @preview}
render 'school_teacher_register', layout: 'web'
end
@ -438,7 +437,7 @@ class LandingsController < ApplicationController
end
@page_data = {retailer: @retailer, invitation_code: params[:invitation_code], defaultEmail: defaultEmail, preview: @preview}
@page_data = {retailer: @retailer, invitation_code: params[:invitation_code], defaultEmail: defaultEmail, preview: @preview}
render 'retailer_teacher_register', layout: 'web'
end
@ -453,7 +452,6 @@ class LandingsController < ApplicationController
end
@page_data = {retailer: @retailer, has_teachers: @retailer.teachers.count > 0}
render 'posa_activation', layout: 'web'
end
@ -475,5 +473,151 @@ class LandingsController < ApplicationController
render 'simple_jamclass', layout: 'web'
end
def amazon_lessons_promo_1
@error = params[:error]
@code = params[:code]
@description = 'Redeem Your Lessons Code From Amazon'
@responsive = true
render 'amazon_lessons_promo_1', layout: 'basic'
end
def amazon_lessons_promo_1_post
code = params[:code]
@code = code
card = PosaCard.find_by_amazon_code(code)
if card
if card.claimed_at
@error = 'Code already claimed'
render 'amazon_lessons_promo_1', layout: 'basic'
return
else
redirect_to '/account/activate/signup?code=' + code
return
end
else
@error = 'Code not valid'
render 'amazon_lessons_promo_1', layout: 'basic'
end
end
def amazon_lessons_promo_2
@description = 'Redeem Your Lessons Code From Amazon'
@responsive = true
@code = params[:code]
if @code.nil? || @code == ''
redirect_to action: :amazon_lessons_promo_1
return
end
card = PosaCard.find_by_amazon_code(@code)
if card
if card.claimed_at
@error = 'Code already claimed'
redirect_to action: :amazon_lessons_promo_1, error: @error
return
else
end
else
@error = 'Code not valid'
redirect_to action: :amazon_lessons_promo_1, error: @error
return
end
render 'amazon_lessons_promo_2', layout: 'basic'
end
def amazon_lessons_promo_2_post
code = params[:code]
@code = code
card = PosaCard.find_by_amazon_code(code)
if card.nil?
@error = 'Code not valid'
redirect_to action: :amazon_lessons_promo_1, error: @error
return
end
if card.claimed_at
@error = 'Code already claimed'
redirect_to action: :amazon_lessons_promo_1, error: @error
return
end
if @current_user
card.claim(current_user)
if card.errors.any?
first = card.errors.first
@error = "#{first[0].to_s.humanize} #{first[1]}"
render 'amazon_lessons_promo_2', layout: 'basic'
else
body = "Name: #{@current_user.name}\n"
body << "Email: #{@current_user.email}\n"
body << "Admin: #{@current_user.admin_student_url}\n"
body << "Package Details: \n"
body << " Package: #{card.lesson_package_type.id}\n"
body << " Credits: #{card.credits}\n"
body << " Code: #{card.code}\n"
AdminMailer.jamclass_alerts({subject: "#{@current_user.email} just applied lesson credits to their account", body: body}).deliver_now
redirect_to '/account/activate/done'
end
else
@email = params[:email]
@password = params[:password]
terms_of_service = params[:terms].nil? || params[:terms] == "0" ? false : true
under_13 = params[:under_13].nil? || params[:under_13] == "0" ? false : true
@terms = terms_of_service ? "checked" : nil
@under13 = under_13 ? "checked" : nil
# try to signup now
@user = UserManager.new.signup(remote_ip: request.remote_ip,
email: params[:email],
password: params[:password],
password_confirmation: params[:password],
gift_card: @code,
terms_of_service: terms_of_service,
under_13: under_13,
skip_recaptcha: true)
if @user.errors.any?
first = @user.errors.first
@error = "#{first[0].to_s.humanize} #{first[1]}"
render 'amazon_lessons_promo_2', layout: 'basic'
return
else
sign_in @user
new_user(@user, nil) # sets a cookie used for GA analytics (one-time new user stuff in JavaScript)
redirect_to '/account/activate/done'
return
end
end
end
def amazon_lessons_promo_3
@description = 'Redeem Your Lessons Code From Amazon - Done!'
@responsive = true
render 'amazon_lessons_promo_3', layout: 'basic'
end
end

View File

@ -99,7 +99,6 @@ module SessionsHelper
redirect_location = signup_hint.redirect_location
end
cookies[:new_user] = { musician: user.musician, registrationType: user.user_authorization('facebook') ? 'Facebook' : 'Native', want_jamblaster: want_jamblaster, redirect_location: redirect_location }.to_json
end

View File

@ -0,0 +1,43 @@
- provide(:page_name, 'amazon_lessons_promo_1')
- provide(:description, @description)
- provide(:title, @title)
#root
.logo-holder
= image_tag("content/amazon_logo.jpg")
.steps
= image_tag("content/1-2-with-1-Bold.png")
.instructions
= 'Paste or enter your promotional code so we can validate it and credit you with 2 free lessons.'
form.code-form method='POST' action='/account/activate/code'
.code-input
label.code-prompt.promo-code
= 'Promo Code:'
- if @error
.error = @error
input autofocus='autofocus' type='text' name='code' value=@code
.code-hint-row
.code-instructions
= 'Your promo code is in the Amazon email notifying you of this award.'
.submit-row
.submit.submit-code
.amazon-button-stack
span.amazon-button
span.amazon-button-inner
a.amazon-a-button-text
= 'Submit Code'
.powered-by
p
= 'powered by '
= image_tag("web/logo_inverted.png")
javascript:
$('a.amazon-a-button-text').on('click', function(e) {
$('form.code-form').submit()
})

View File

@ -0,0 +1,87 @@
- provide(:page_name, 'amazon_lessons_promo_2')
- provide(:description, @description)
- provide(:title, @title)
form#root method='POST' action='/account/activate/signup'
.logo-holder.create-account
= image_tag("content/amazon_logo.jpg")
.steps
= image_tag("content/1-2-with-2-Bold.png")
.success-msg
| Success!&nbsp;
wbr
| Your code has been validated!
-if @current_user
.instructions.create-account
input type='hidden' name='code' value=@code
- if @error
.error = @error
= 'Click the button below to credit your account with your 2 free lessons.'
.submit-row.create-account
.submit.create-account
.amazon-button-stack
span.amazon-button
span.amazon-button-inner
a.amazon-a-button-text
= 'Apply Credits'
-else
.instructions.create-account
= 'Enter your email address and password so we can create a JamKazam account for you and credit your account with your 2 free lessons.'
.code-form.create-account
.text-input
label.code-prompt.email
= 'Email:'
- if @error
.error = @error
input type='hidden' name='code' value=@code
input autofocus='autofocus' type='text' name='email' value=@email
.password-row
.text-input
label.code-prompt.password
= 'Password:'
input type='password' name='password' value=@password
.terms-row
label.code-prompt
.checkbox-input
input type='checkbox' name='terms' checked=@terms
label
| I have read and agree to the JamKazam&nbsp;
= link_to 'terms of service', '/corp/terms', target: '_blank'
.under13-row
.checkbox-input
input type='checkbox' name='under_13' checked=@under13
label
| I am creating this account for a child under 13 years old (
= link_to 'why do we ask?', 'https://jamkazam.desk.com/customer/portal/articles/2887343-coppa-explanation', target: '_blank'
| )
.submit-row.create-account
.submit.create-account
.amazon-button-stack
span.amazon-button
span.amazon-button-inner
a.amazon-a-button-text
= 'Create Account'
.powered-by.create-account
.code-prompt
p
= 'powered by '
= image_tag("web/logo_inverted.png")
javascript:
var submitted = false
$('a.amazon-a-button-text').on('click', function(e) {
if(!submitted) {
submitted = true
console.log("submit button clicked")
$('form#root').submit()
}
})

View File

@ -0,0 +1,22 @@
- provide(:page_name, 'amazon_lessons_promo_3')
- provide(:description, @description)
- provide(:title, @title)
#root
.logo-holder
= image_tag("content/amazon_logo.jpg")
.success-msg
= "You're all set!"
.instructions
p Within the next day or two, someone from JamKazam will reach out to you via email to help guide you through getting ready for your first lesson and picking a great teacher for you.
p
| If you have any questions at any time, feel free to contact us at&nbsp;
a href="mailto:support@jamkazam.com" support@jamkazam
| .
.powered-by
p
= 'powered by '
= image_tag("web/logo_inverted.png")

View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie.css" media="screen, projection"/>
<![endif]-->
<!--<link href='http://fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700' rel='stylesheet' type='text/css'>-->
<%= stylesheet_link_tag "basic/basic", media: "all" %>
<%= include_gon(:init => true) %>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="<%= meta_description(yield(:description)) %>">
<% if content_for?(:social_meta) %>
<%= yield(:social_meta) %>
<% else %>
<%= render "layouts/social_meta" %>
<% end %>
<%= render "shared/ad_sense" %>
</head>
<body class="basic <%= yield(:page_name) %>">
<div id="basic-container">
<%= javascript_include_tag "basic/basic" %>
<div class="wrapper">
<%= yield %>
</div>
</div>
<%= render "clients/jamServer" %>
<%= render "clients/help" %>
<%= render 'dialogs/banner' %>
<%= render 'dialogs/banners/disconnected' %>
<script type="text/javascript">
$(function () {
JK = JK || {};
JK.root_url = "<%= root_url %>"
JK.app = JK.JamKazam();
var jamServer = new JK.JamServer(JK.app, $.noop);
jamServer.initialize();
JK.app.initialize({inClient: false, layoutOpts: {layoutFooter: false, sizeOverlayToContent: true}});
<% if current_user %>
JK.currentUserId = '<%= current_user.id %>';
JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
JK.currentUserName = '<%= current_user.name %>';
<% else %>
JK.currentUserId = null;
JK.currentUserAvatarUrl = null;
JK.currentUserName = null;
<% end %>
<% if @websocket %>
JK.JamServer.connect() // singleton here defined in JamServer.js
.done(function() {
console.log("websocket connected")
})
.fail(function() {
//console.log("websocket failed to connect")
});
<% end %>
})
</script>
<%= render "shared/ga" %>
<%= render "shared/olark" %>
<!-- version info: <%= version %> -->
</body>
</html>

View File

@ -89,6 +89,7 @@ if defined?(Bundler)
config.assets.precompile += %w( web/web.js web/web.css )
config.assets.precompile += %w( minimal/minimal.js minimal/minimal.css )
config.assets.precompile += %w( modern/modern.js modern/modern.css )
config.assets.precompile += %w( basic/basic.js basic/basic.css )
# where is rabbitmq?
config.rabbitmq_host = "127.0.0.1"
@ -447,7 +448,7 @@ if defined?(Bundler)
config.end_of_wait_window_forgiveness_minutes = 1
config.olark_enabled = true
config.jamclass_enabled = false
config.musician_count = '40,000+'
config.musician_count = '75,000+'
config.jamblaster_menu = false
# Applications created before Rails 4.1 uses Marshal to serialize cookie values into the signed and encrypted cookie jars.
# If you want to use the new JSON-based format in your application, you can add an initializer file with the following content:

View File

@ -2,7 +2,6 @@ Resque.redis = Rails.application.config.redis_host
require 'resque_failed_job_mailer'
puts "RESQUE INITIALIZER"
Resque::Failure::Notifier.configure do |config|
config.to = Rails.application.config.email_alerts_alias
config.from = Rails.application.config.email_generic_from

View File

@ -1 +0,0 @@
puts "DEPRECATED INITILAIZER"

View File

@ -22,7 +22,12 @@ Rails.application.routes.draw do
delete '/signout', to: 'sessions#destroy'
match '/redeem_giftcard', to: 'landings#redeem_giftcard', via: :get
match '/account/activate/code', to: 'landings#account_activate', via: :get
match '/account/activate/code_old', to: 'landings#account_activate', via: :get
match '/account/activate/code', to: 'landings#amazon_lessons_promo_1', via: :get
match '/account/activate/code', to: 'landings#amazon_lessons_promo_1_post', via: :post
match '/account/activate/signup', to: 'landings#amazon_lessons_promo_2', via: :get
match '/account/activate/signup', to: 'landings#amazon_lessons_promo_2_post', via: :post
match '/account/activate/done', to: 'landings#amazon_lessons_promo_3', via: :get
# landing pageslanding
get '/jamtracks', to: 'landings#simple_jamtracks', as: 'landing_simple_jamtracks'

View File

@ -45,6 +45,7 @@ class UserManager < BaseManager
education_interest = options[:education_interest]
origin = options[:origin]
test_drive_package = options[:test_drive_package]
under_13 = options[:under_13]
recaptcha_failed = false
unless options[:skip_recaptcha] # allow callers to opt-of recaptcha
@ -100,7 +101,8 @@ class UserManager < BaseManager
school_interest: school_interest,
education_interest: education_interest,
origin: origin,
test_drive_package: test_drive_package)
test_drive_package: test_drive_package,
under_13: under_13)
user
end