diff --git a/admin/app/admin/posa_card_upload.rb b/admin/app/admin/posa_card_upload.rb
index 784a325c3..73fed6cf0 100644
--- a/admin/app/admin/posa_card_upload.rb
+++ b/admin/app/admin/posa_card_upload.rb
@@ -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
diff --git a/db/manifest b/db/manifest
index 08b38d4d1..21feab3b6 100755
--- a/db/manifest
+++ b/db/manifest
@@ -377,4 +377,5 @@ guitar_center_integration_v1.sql
mobile_recording_support.sql
youtube_broadcast.sql
amazon_v1.sql
-sms_index_optimize.sql
\ No newline at end of file
+sms_index_optimize.sql
+amazon_signup.sql
diff --git a/db/up/amazon_signup.sql b/db/up/amazon_signup.sql
new file mode 100644
index 000000000..dd4196e48
--- /dev/null
+++ b/db/up/amazon_signup.sql
@@ -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;
\ No newline at end of file
diff --git a/db/up/sms_index_optimize.sql b/db/up/sms_index_optimize.sql
index 13b0bb204..715bb9f36 100644
--- a/db/up/sms_index_optimize.sql
+++ b/db/up/sms_index_optimize.sql
@@ -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)
\ No newline at end of file
+-- 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;
\ No newline at end of file
diff --git a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb
index 376b2c0fa..bba31d238 100644
--- a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb
+++ b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb
@@ -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!"
diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.html.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.html.erb
new file mode 100644
index 000000000..352812433
--- /dev/null
+++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.html.erb
@@ -0,0 +1,18 @@
+
+ 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 you’re 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.
+
+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 you’ll be using in your lessons.
+
+
+Thanks again for joining our community of <%= APP_CONFIG.musician_count %> musicians and starting your musical journey with us! We’ll be in touch very soon.
+
+
+Best Regards,
+ Team JamKazam
\ No newline at end of file
diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.text.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.text.erb
new file mode 100644
index 000000000..ad965437d
--- /dev/null
+++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.text.erb
@@ -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 you’re 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.
+
+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 you’ll be using in your lessons.
+
+Thanks again for joining our community of <%= APP_CONFIG.musician_count %> musicians and starting your musical journey with us! We’ll be in touch very soon.
+
+Best Regards,
+Team JamKazam
\ No newline at end of file
diff --git a/ruby/lib/jam_ruby/models/lesson_package_type.rb b/ruby/lib/jam_ruby/models/lesson_package_type.rb
index 7c93e3d98..ae8198a58 100644
--- a/ruby/lib/jam_ruby/models/lesson_package_type.rb
+++ b/ruby/lib/jam_ruby/models/lesson_package_type.rb
@@ -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
diff --git a/ruby/lib/jam_ruby/models/posa_card.rb b/ruby/lib/jam_ruby/models/posa_card.rb
index 604dee8fe..da87d00b2 100644
--- a/ruby/lib/jam_ruby/models/posa_card.rb
+++ b/ruby/lib/jam_ruby/models/posa_card.rb
@@ -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?
diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb
index 6db0617d0..600cfd550 100644
--- a/ruby/lib/jam_ruby/models/user.rb
+++ b/ruby/lib/jam_ruby/models/user.rb
@@ -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
diff --git a/web/app/assets/images/content/1-2-with-1-Bold.png b/web/app/assets/images/content/1-2-with-1-Bold.png
new file mode 100644
index 000000000..c7da325b1
Binary files /dev/null and b/web/app/assets/images/content/1-2-with-1-Bold.png differ
diff --git a/web/app/assets/images/content/1-2-with-2-Bold.png b/web/app/assets/images/content/1-2-with-2-Bold.png
new file mode 100644
index 000000000..8c0ecafcc
Binary files /dev/null and b/web/app/assets/images/content/1-2-with-2-Bold.png differ
diff --git a/web/app/assets/images/content/amazon_logo.jpg b/web/app/assets/images/content/amazon_logo.jpg
new file mode 100644
index 000000000..856d9528a
Binary files /dev/null and b/web/app/assets/images/content/amazon_logo.jpg differ
diff --git a/web/app/assets/images/web/logo_inverted.png b/web/app/assets/images/web/logo_inverted.png
new file mode 100644
index 000000000..bff739903
Binary files /dev/null and b/web/app/assets/images/web/logo_inverted.png differ
diff --git a/web/app/assets/javascripts/JamServer.js b/web/app/assets/javascripts/JamServer.js
index 06cd1b905..d57d1ff37 100644
--- a/web/app/assets/javascripts/JamServer.js
+++ b/web/app/assets/javascripts/JamServer.js
@@ -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);
});
});
diff --git a/web/app/assets/javascripts/basic/basic.js b/web/app/assets/javascripts/basic/basic.js
new file mode 100644
index 000000000..331325c3c
--- /dev/null
+++ b/web/app/assets/javascripts/basic/basic.js
@@ -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
\ No newline at end of file
diff --git a/web/app/assets/stylesheets/basic/basic.scss b/web/app/assets/stylesheets/basic/basic.scss
new file mode 100644
index 000000000..a30817f3d
--- /dev/null
+++ b/web/app/assets/stylesheets/basic/basic.scss
@@ -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;
+}
\ No newline at end of file
diff --git a/web/app/controllers/landings_controller.rb b/web/app/controllers/landings_controller.rb
index 94e64728b..d271dc4ac 100644
--- a/web/app/controllers/landings_controller.rb
+++ b/web/app/controllers/landings_controller.rb
@@ -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
diff --git a/web/app/helpers/sessions_helper.rb b/web/app/helpers/sessions_helper.rb
index 6301e08a0..eef5af241 100644
--- a/web/app/helpers/sessions_helper.rb
+++ b/web/app/helpers/sessions_helper.rb
@@ -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
diff --git a/web/app/views/landings/amazon_lessons_promo_1.slim b/web/app/views/landings/amazon_lessons_promo_1.slim
new file mode 100644
index 000000000..665b2bbf3
--- /dev/null
+++ b/web/app/views/landings/amazon_lessons_promo_1.slim
@@ -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()
+
+ })
+
diff --git a/web/app/views/landings/amazon_lessons_promo_2.slim b/web/app/views/landings/amazon_lessons_promo_2.slim
new file mode 100644
index 000000000..c250d316f
--- /dev/null
+++ b/web/app/views/landings/amazon_lessons_promo_2.slim
@@ -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!
+ 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
+ = 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()
+ }
+
+ })
+
diff --git a/web/app/views/landings/amazon_lessons_promo_3.slim b/web/app/views/landings/amazon_lessons_promo_3.slim
new file mode 100644
index 000000000..7ca3b7eb6
--- /dev/null
+++ b/web/app/views/landings/amazon_lessons_promo_3.slim
@@ -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
+ a href="mailto:support@jamkazam.com" support@jamkazam
+ | .
+
+ .powered-by
+ p
+ = 'powered by '
+ = image_tag("web/logo_inverted.png")
\ No newline at end of file
diff --git a/web/app/views/layouts/basic.html.erb b/web/app/views/layouts/basic.html.erb
new file mode 100644
index 000000000..02307d3b7
--- /dev/null
+++ b/web/app/views/layouts/basic.html.erb
@@ -0,0 +1,76 @@
+
+
+
+ <%= full_title(yield(:title)) %>
+
+
+
+ <%= stylesheet_link_tag "basic/basic", media: "all" %>
+ <%= include_gon(:init => true) %>
+ <%= csrf_meta_tags %>
+
+
+ <% if content_for?(:social_meta) %>
+ <%= yield(:social_meta) %>
+ <% else %>
+ <%= render "layouts/social_meta" %>
+ <% end %>
+ <%= render "shared/ad_sense" %>
+
+
+
+ <%= javascript_include_tag "basic/basic" %>
+
+ <%= yield %>
+
+
+<%= render "clients/jamServer" %>
+<%= render "clients/help" %>
+<%= render 'dialogs/banner' %>
+<%= render 'dialogs/banners/disconnected' %>
+
+
+
+
+<%= render "shared/ga" %>
+<%= render "shared/olark" %>
+
+
+
\ No newline at end of file
diff --git a/web/config/application.rb b/web/config/application.rb
index 8b300ace8..1e65eefc1 100644
--- a/web/config/application.rb
+++ b/web/config/application.rb
@@ -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:
diff --git a/web/config/initializers/resque.rb b/web/config/initializers/resque.rb
index 7c896f7aa..87e9107c4 100644
--- a/web/config/initializers/resque.rb
+++ b/web/config/initializers/resque.rb
@@ -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
diff --git a/web/config/initializers/resque_failed_job_mailer.rb b/web/config/initializers/resque_failed_job_mailer.rb
index 204f3ef80..e69de29bb 100644
--- a/web/config/initializers/resque_failed_job_mailer.rb
+++ b/web/config/initializers/resque_failed_job_mailer.rb
@@ -1 +0,0 @@
-puts "DEPRECATED INITILAIZER"
\ No newline at end of file
diff --git a/web/config/routes.rb b/web/config/routes.rb
index 521e3bae4..82a99e267 100644
--- a/web/config/routes.rb
+++ b/web/config/routes.rb
@@ -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'
diff --git a/web/lib/user_manager.rb b/web/lib/user_manager.rb
index 4fb3f4cea..02428f26f 100644
--- a/web/lib/user_manager.rb
+++ b/web/lib/user_manager.rb
@@ -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