Merged in VRFS-4993_signup_and_download_page_changes (pull request #6)

VRFS-4993 signup and download page changes

Approved-by: Seth Call
This commit is contained in:
Nuwan Chaturanga 2021-03-16 14:00:51 +00:00 committed by Seth Call
commit d8f7582790
26 changed files with 1274 additions and 241 deletions

View File

@ -1466,7 +1466,8 @@ module JamRuby
location = options[:location]
instruments = options[:instruments]
birth_date = options[:birth_date]
musician = options[:musician]
#musician = options[:musician]
musician = true
photo_url = options[:photo_url]
invited_user = options[:invited_user]
fb_signup = options[:fb_signup]

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
//= require ./jquery-3.5.1.min
//= require jquery_ujs
//= require ./bootstrap.min
//= require ./bootstrap.bundle.min
//= require AAC_underscore
//= require utils
//= require jam_rest
//= require jamkazam
//= require ga
//= require ../landing/signup
//= require ../web/downloads

File diff suppressed because one or more lines are too long

View File

@ -105,6 +105,10 @@
// update the 'download other platforms' buttons
$('body.web .downloads-container').empty().append(selectOthers);
// update system requirements
if($('#client-download-system-requirements').length){
var systemRequirements = $(context._.template($('#client-download-system-requirements').html(), options, { variable: 'data' }));
$('body.web .system-requirements').empty().append(systemRequirements);
}
$('body.web .system-requirements ul').hide();
$('body.web .system-requirements ul.' + platformName + '-requirements').show();
$('body.web .system-requirements').show();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
/**
*= require ./bootstrap.min
*= require ./landing
*/

View File

@ -0,0 +1,106 @@
@charset "UTF-8";
.page {
width: 100%;
}
.header {
height: auto;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Zilla Slab";
font-weight: 600;
}
body, div, p {
font-family: "Open Sans";
font-weight: 500;
font-size: 18px;
}
.main {
background-image: linear-gradient(180deg,#007582 0%,#22a39c 100%);
}
.container {
padding: 40px 15px;
}
label {
font-size: 12px;
}
input[type=text],input[type=email],input[type=password] {
border-radius: 5px;
width: 100%;
padding: 8px;
border: solid 1px #ccc;
}
button {
font-family: "Open Sans";
font-size: 20px;
font-weight: 600;
padding: 8px 20px;
border-radius: 5px;
color: #ffffff;
background-color: #F05423;
transition: 0.3s;
border: none;
}
button:hover {
background-color: #007582;
}
a {
color: #F05423;
}
.text-white a {
color: white;
}
a:hover {
color: #007582;
}
.jk-overlay {
position: absolute;
display: none;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 99;
background: rgba(0,0,0,0.50);
padding-top: 40px;
}
.jk-modal {
width: 90%;
padding: 40px;
max-width: 750px;
border-radius: 10px;
background: rgba(255,255,255,1);
position: relative;
margin: 0 auto;
z-index: 100;
}
.field_with_errors input{
border-color: #dc3545;
display: table;
}
.field_with_errors .error-text{
color: #dc3545;
font-size: small;
}
.hidden{
display: none;
}
div.register-as {
margin-left:45px;
display:none;
}
.windows-requirements, .mac-requirements, .linux-requirements{
font-size: 16px;
list-style-type: disc;
}

View File

@ -23,7 +23,6 @@ class UsersController < ApplicationController
before_filter :is_native_client
before_filter :ip_blacklist, :only => [:create]
rescue_from 'JamRuby::PermissionError' do |exception|
@exception = exception
render :file => 'public/403.html', :status => 403, :layout => false
@ -97,7 +96,7 @@ class UsersController < ApplicationController
@affiliate_partner = load_affiliate_partner(params)
@signup_postback = load_postback(@invited_user, @fb_signup, @affiliate_partner)
@signup_postback = load_postback(@invited_user, @fb_signup, @affiliate_partner, request.path)
load_location(request.remote_ip)
@ -114,11 +113,11 @@ class UsersController < ApplicationController
@user.gender = @fb_signup.gender
end
render :layout => 'web'
#render :layout => 'jk2021'
_render('new')
end
def create
if current_user
redirect_to client_url
return
@ -157,7 +156,7 @@ class UsersController < ApplicationController
@invited_user = load_invited_user(params)
@affiliate_partner = load_affiliate_partner(params)
@signup_postback = load_postback(@invited_user, @fb_signup, @affiliate_partner)
@signup_postback = load_postback(@invited_user, @fb_signup, @affiliate_partner, request.path)
instruments = fixup_instruments(params[:jam_ruby_user][:instruments])
@ -200,7 +199,8 @@ class UsersController < ApplicationController
gon.signup_errors = true
gon.musician_instruments = instruments
gon.plan_code = desired_plan_code
render "new", :layout => 'web'
#render "new", :layout => 'jk2021'
_render('new')
else
sign_in @user
@ -224,7 +224,8 @@ class UsersController < ApplicationController
def downloads
@no_user_dropdown = true
@page_context = 'standalone'
render :layout => "web"
#render :layout => "jk2021"
_render('downloads')
end
# DO NOT USE CURRENT_USER IN THIS ROUTINE UNLESS REDIRECTING. IT'S CACHED FOR THE WHOLE SITE
@ -438,6 +439,16 @@ JS
private
def _render(action)
layout_template = case action
when 'new'
request.path == '/landing/general/signup' ? ['jk2021', 'new2021'] : ['web', 'new']
when 'downloads'
request.path == '/landing/general/downloads' ? ['jk2021', 'downloads2021'] : ['web', 'downloads']
end
render layout_template[1], :layout => layout_template[0]
end
def is_native_client
@nativeClient = is_native_client?
end
@ -525,15 +536,15 @@ JS
@cities = @location[:state].nil? ? [] : MaxMindManager.cities(@location[:country], @location[:state])
end
def load_postback(invited_user, fb_signup, affiliate_partner)
def load_postback(invited_user, fb_signup, affiliate_partner, request_path)
query = {}
query[:invitation_code] = invited_user.invitation_code if invited_user
query[:facebook_signup] = fb_signup.lookup_id if fb_signup
query[:affiliate_partner_id] = affiliate_partner.id if affiliate_partner
if query.length > 0
signup_path + "?" + query.to_query
request_path + "?" + query.to_query
else
signup_path
request_path
end
end
end

View File

@ -4,4 +4,24 @@ module ErrorsHelper
{"errors" => {field => [error_msg]}}
end
def errors_for(object)
if object.errors.any?
content_tag(:div, class: 'card text-white bg-danger mb-3') do
concat(content_tag(:div, class: 'card-header') do
concat(content_tag(:h4) do
concat "The form contains #{pluralize(object.errors.count, 'error')}:"
end)
end)
concat(content_tag(:div, class: 'card-body') do
concat(content_tag(:ul) do
object.errors.full_messages.each do |msg|
concat content_tag(:li, msg)
end
end)
end)
end
end
end
end

View File

@ -0,0 +1,57 @@
- provide(:page_name, 'landing_page full landing_product affiliate_program')
- provide(:description, 'Signup for JamKazam Affiliate Program')
.row
.column
h1.product-headline JamKazam Affiliate Program
p Do you have a following of musicians on Facebook, YouTube, Twitter or an email list? Generate income simply by letting them know about JamKazam.
p Let's say you make YouTube tutorial videos. You can link directly from a video on how to play "Back in Black" to our JamTrack for that song. Video watchers can get this first JamTrack free, and can buy others if they like. You get paid every time they buy something from us for 2 years.
p Or let's say you have a Facebook group for guitarist with 5,000 members. You can let them know they can play together free on JamKazam. For everyone who signs up, you get paid every time they buy something from us for 2 years.
p You don't have to sell anything. Just let your followers know about cool new stuff they'll like! To get started, simply review the affiliate agreement below, accept it (at the end of the agreement), and then start sharing links with your affiliate code. When referred users buy JamTracks, JamBlasters, JamLessons, and so on, you get paid!
.column
h1 Learn How to Make Money by Referring Users
- if !Rails.env.test?
.video-wrapper
.video-container
iframe src="//www.youtube.com/embed/96YTnO_H9a4" frameborder="0" allowfullscreen
br clear="all"
.row
h1 JamKazam Affiliate Agreement
= render "legal/partner_agreement_v1"
p.agreement-notice By clicking the "I Agree" button below, I certify that I have the authority to enter into this Agreement on behalf of myself as an individual or on behalf of the entity I have listed below, and I further certify that I have read, understood, and agree to be bound by the terms above.
.entity-options
.field.radio
= radio_button_tag(:entity, 'individual')
label I am entering into this Agreement as an individual
.field.radio
= radio_button_tag(:entity, 'entity')
label I am executing this Agreement on behalf of the company or entity listed below
.entity-info.hidden
.field.entity.name
label Entity Name
input type="text" name="entity-name"
.field.entity.type
label Entity Type
select name="entity-type"
option value="" Choose Entity Type
option value="Sole Proprietor" Sole Proprietor
option value="Limited Liability Company (LLC)" Limited Liability Company (LLC)
option value="Partnership" Partnership
option value="Trust/Estate" Trust/Estate
option value="S Corporation" S Corporation
option value="C Corporation" C Corporation
option value="Other" Other
.agree-disagree-buttons
= link_to image_tag("content/agree_button.png", {:width => 213, :height => 50 }), '#', class: "agree-button"
= link_to image_tag("content/disagree_button.png", {:width => 213, :height => 50 }), '#', class: "disagree-button"
p.disagree-text.hidden
| Thank you for your interest in the JamKazam affiliate program. We are sorry, but you cannot join the program without consenting to the terms of this Agreement.
javascript:
$(document).on('JAMKAZAM_READY', function(e, data) {
var affiliateProgram = new JK.AffiliateProgram(data.app);
affiliateProgram.initialize();
})

View File

@ -0,0 +1,211 @@
<% provide(:page_name, 'register') %>
<% provide(:title, 'Register') %>
<% provide(:description, 'Sign up for your JamKazam account to play music with others online in real time and network with musicians.') %>
<% provide(:hero_title, 'JamKazam has spent the last 6 years building the best platform in the world to let musicians play together live and in sync over the Internet.') %>
<div class="row">
<div class="col-md-8 col-sm-12">
<strong>Today tens of thousands of musicians use JamKazam to:</strong>
<ul>
<li>Rehearse with their bands from home</li>
<li>Join open sessions to meet &amp; play with new friends</li>
<li>Co-write music live &amp; interactively vs. trading files</li>
<li>Record session performances</li>
<li>Live broadcast session performances thru YouTube &amp; Facebook</li>
</ul>
<p style="font-size:16px">Check out some examples of groups playing together on JamKazam:</p>
<iframe width="625" height="400" src="https://www.youtube.com/embed/euxDykIqUdo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="col-md-4 col-sm-12">
<p>Sign up for a free account now and get <a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000122535-what-are-jamkazam-s-free-vs-premium-features-">Gold premium subscription</a> features FREE for 30 days! After 30 days you can continue playing on our free plan or select a premium plan whatever is right for you. When you sign up, well send you an email with instructions on how to set up and play on the platform.</p>
<%= errors_for @user %>
<%= form_for(@user, :url => @signup_postback, :method => :post, html: { id: 'signup' }) do |f| %>
<div class="row mb-2">
<div class="col-md-6 col-sm-12">
<%= f.label :first_name, "First Name:" %>
<%= f.text_field :first_name %>
</div>
<div class="col-md-6 col-sm-12">
<%= f.label :last_name, "Last Name:" %>
<%= f.text_field :last_name %>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<%= f.label :email, "Email Address:" %>
<%= f.text_field :email %>
</div>
</div>
<div class="row mb-2">
<div class="col-md-12">
<%= f.label :password, "Choose a Password:" %>
<%= f.password_field :password %>
</div>
</div>
<div class="row mb-2">
<div class="col-md-12">
<%= f.label :password_confirmation, "Verify Password:" %>
<%= f.password_field :password_confirmation %>
</div>
</div>
<div class="row mt-3">
<div class="col-12">
<%= f.check_box :terms_of_service %> <label for="user_terms_of_service" style="font-size: 90%">I agree to the JamKazam <%= link_to "terms of service", corp_terms_path, :rel => "external" %></label>
</div>
</div>
<div class="row mb-2">
<div class="col-12 recaptcha">
<% if Rails.application.config.recaptcha_enable %>
<div id="recaptcha_select" name="recaptcha_response_field" class="g-recaptcha" data-sitekey="<%=Rails.application.config.recaptcha_public_key%>" data-callback="recaptcha_success" data-expired-callback="recaptcha_expired">
</div>
<% end %>
</div>
</div>
<div class="row mb-2">
<div class="col-12"><br />
<button id="create-account-submit" onClick="$document.forms['signup'].submit()" style="width:100%">Sign Up for JamKazam</button>
</div>
</div>
<% end %>
</div>
</div>
<%= content_for(:scripts) do %>
<script type="text/javascript">
//window.signup.handle_location_changes()
// window.signup.handle_register_as_changes()
function recaptcha_success(response) {
//$("#create-account-submit").removeClass("disabled")
$("#create-account-submit").prop("disabled", false)
}
function recaptcha_expired(response) {
//$("#create-account-submit").addClass("disabled")
$("#create-account-submit").prop("disabled", true)
}
function get_first_error(field) {
if (errors[field] && errors[field].length > 0) {
return errors[field][0]
}
else {
return null;
}
}
// populate musician instruments from previous submit, if applicable
// if (window.gon && gon.musician_instruments) {
// $(gon.musician_instruments).each(function (index, value) {
// $('#' + value.instrument_id.replace(" ", "") + "_checkbox").attr("checked", true);
// $('#' + value.instrument_id.replace(" ", "") + "_proficiency").val(value.proficiency_level.toString())
// })
// }
// if(window.gon) {
// var $radios = $('input:radio[name="jam_ruby_user[desired_plan_code]"]');
// if(gon.plan_code) {
// $radios.filter(gon.plan_code, true)
// }
// else {
// $radios.filter('[value="<%= @plan_code %>"]').prop('checked', true)
// }
// }
// show signup errors, if any
if (window.gon && gon.signup_errors) {
var errors =
<%= @user.errors.to_json.html_safe %>
var email = get_first_error("email")
var first_name = get_first_error("first_name")
var last_name = get_first_error("last_name")
var musician_instruments = get_first_error("musician_instruments")
var password = get_first_error("password")
var password_confirmation = get_first_error("password_confirmation")
var terms_of_service = get_first_error("terms_of_service")
var country = get_first_error("country")
var state = get_first_error("state")
var city = get_first_error("city")
var recaptcha = get_first_error("recaptcha")
if (email) {
var emailInput = $('#jam_ruby_user_email');
emailInput.closest('div.field').addClass('error')
emailInput.after("<div class='error-text'>" + email + "</div>")
}
if (first_name) {
var firstNameInput = $('#jam_ruby_user_first_name');
firstNameInput.closest('div.field').addClass('error')
firstNameInput.after("<div class='error-text'>" + first_name + "</div>")
}
if (last_name) {
var lastNameInput = $('#jam_ruby_user_last_name');
lastNameInput.closest('div.field').addClass('error')
lastNameInput.after("<div class='error-text'>" + last_name + "</div>")
}
if (country) {
var countryInput = $('#country_select');
countryInput.closest('div.field').addClass('error')
countryInput.after("<div class='error-text'>" + country + "</div>")
}
if (state) {
var stateInput = $('#region_select');
stateInput.closest('div.field').addClass('error')
stateInput.after("<div class='error-text'>" + state + "</div>")
}
if (city) {
var cityInput = $('#city_select');
cityInput.closest('div.field').addClass('error')
cityInput.after("<div class='error-text'>" + city + "</div>")
}
if (recaptcha) {
var recaptchaInput = $('#recaptcha_select');
recaptchaInput.closest('div.field').addClass('error')
recaptchaInput.after("<div class='error-text'>" + recaptcha + "</div>")
}
if (musician_instruments) {
var musicianInstrumentsInput = $('#instrument_selector');
musicianInstrumentsInput.closest('div.ftue-instrumentlist-wrapper').addClass('error')
musicianInstrumentsInput.closest('div.ftue-instrumentlist').after("<div class='error-text'>" + musician_instruments + "</div>")
}
if (password) {
var passwordInput = $('#jam_ruby_user_password');
passwordInput.closest('div.field').addClass('error')
passwordInput.after("<div class='error-text'>" + password + "</div>")
}
if (password_confirmation) {
var passwordConfirmationInput = $('#jam_ruby_user_password_confirmation');
passwordConfirmationInput.closest('div.field').addClass('error')
passwordConfirmationInput.after("<div class='error-text'>" + password_confirmation + "</div>")
}
if (terms_of_service) {
var termsOfServiceInput = $('#jam_ruby_user_terms_of_service');
termsOfServiceInput.closest('small').addClass('error')
termsOfServiceInput.after("<div class='error-text'>" + terms_of_service + "</div>")
}
}
</script>
<% end %>

View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<title><%= full_title(yield(:title)) %></title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Zilla+Slab:300,300italic,regular,italic,500,500italic,600,600italic,700,700italic|Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic&subset=latin,latin-ext&display=swap" type="text/css" media="all">
<%= stylesheet_link_tag "jk2021/jk2021", media: "all" %>
<%= include_gon(:init => true) %>
<%= csrf_meta_tags %>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=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="web jam <%= yield(:page_name) %>>
<div class="page">
<header id="main-header" class="header container">
<div class="row">
<div class="col-md-4 col-sm-12">
<a href="/">
<%= image_tag 'JK_Logo_2c.png', alt: "JamKazam", id: "logo", style: "width:100%" %>
</a>
</div>
</div>
</header>
<% if content_for?(:hero_title) %>
<div class="main container-fluid">
<div class="container text-white">
<div class="row">
<div class="col-12">
<h3><%= yield :hero_title %> </h3>
</div>
</div>
</div>
</div>
<% end %>
<div class="container">
<%= yield %>
</div>
</div>
<footer class="bg-dark text-white">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-12">
&copy; 2021 JamKazam, Inc. All rights reserved.
</div>
<div class="col-md-6 col-sm-12 text-right">
<a href="https://jamkazam.com">jamkazam.com</a>
</div>
</div>
</div>
</footer>
<%= javascript_include_tag "jk2021/jk2021" %>
<% if content_for?(:scripts) %>
<%= yield :scripts %>
<% end %>
<%= render "shared/ga" %>
</body>
</html>

View File

@ -1,4 +1,3 @@
script type="text/template" id="client-download-blurb-contents"
.downloads

View File

@ -0,0 +1,44 @@
script type="text/template" id="client-download-blurb-contents"
.downloads.text-center
a href="{{data.uri}}" class="current-os-download" data-platform="{{data.platform}}"
.hidden.hidden-images
= image_tag("content/button_download_mac.png", :alt => "download mac", :size => "348x92", "data-purpose" => "mac")
= image_tag("content/button_download_windows.png", :alt => "download windows", :size => "348x92", "data-purpose" => "windows")
= image_tag("content/button_download_linux.png", :alt => "download linux", :size => "348x92", "data-purpose" => "linux")
script type="text/template" id="client-download-select-others"
.download-box.text-center
.download-others
| Need a different version?
br
a.choose-other-platform href="#" data-order="1" data-platform="{{data.platform1}}"
| Click here to get JamKazam for {{data.platformDisplay1}}
script type="text/template" id="client-download-system-requirements"
p
em System Requirements:
| {% if(data.platform == "Win32") { %}
ul.windows-requirements
li Windows 7, 8, or 10 - 64-bit (32-bit not supported)
li Dual core processor or higher
li 75MB hard disk space for app
li External audio interface recommended (but you can start with built-in mic and & headphone jack)
li USB 2.0, USB 3.0, Thunderbolt, or Firewire (not USB 1.1) for external audio interfaces
li Ethernet port for real-time online sessions (WiFi not recommended)
li Broadband Internet service with 1Mbps uplink bandwidth for real-time online sessions
| {% } else if(data.platform == "MacOSX") { %}
ul.mac-requirements
li Mac OS X 10.8 or higher, 64-bit
li Dual-core processor or higher
li 75MB hard disk space for app
li External audio interface recommended (but you can start with built-in mic and & headphone jack)
li USB 2.0, USB 3.0, Thunderbolt, or Firewire (not USB 1.1) for external audio interfaces
li Ethernet port for real-time online sessions (WiFi not recommended)
li Broadband Internet service with 1Mbps uplink bandwidth for real-time online sessions
| {% } else { %}
ul.linux-requirements
li Linux is not yet supported
| {% } %}

View File

@ -0,0 +1,19 @@
// used by congrats_musician, and downloads
- provide(:page_name, "downloads #{@page_context}")
- provide(:hero_title, 'Signup successful! Now download the JamKazam application.')
.row
.col-md-7.col-sm-12
p.click-to-download You need the JamKazam Mac or Windows app to play in online sessions on the JamKazam platform. Click the button below to download the app.
br
.downloads-blurb
br
.downloads-container
.col-md-1.col-sm-0
.col-md-4.col-sm-12
.system-requirements
= render "users/download_templates2021"

View File

@ -5,4 +5,4 @@
<script type="text/javascript">
$(function() { window.JK.Downloads.listClients(false) } );
</script>
</script>

View File

@ -0,0 +1,10 @@
<% provide(:title, 'Downloads') %>
<% provide(:description, 'Download the JamKazam app for Windows or Mac to play music online with others.') %>
<%= render "users/downloads2021" %>
<%= content_for :scripts do %>
<script type="text/javascript">
$(function() { window.JK.Downloads.listClients(false) } );
</script>
<% end %>

View File

@ -0,0 +1,211 @@
<% provide(:page_name, 'register') %>
<% provide(:title, 'Register') %>
<% provide(:description, 'Sign up for your JamKazam account to play music with others online in real time and network with musicians.') %>
<% provide(:hero_title, 'JamKazam has spent the last 6 years building the best platform in the world to let musicians play together live and in sync over the Internet.') %>
<div class="row">
<div class="col-md-8 col-sm-12">
<strong>Today tens of thousands of musicians use JamKazam to:</strong>
<ul>
<li>Rehearse with their bands from home</li>
<li>Join open sessions to meet &amp; play with new friends</li>
<li>Co-write music live &amp; interactively vs. trading files</li>
<li>Record session performances</li>
<li>Live broadcast session performances thru YouTube &amp; Facebook</li>
</ul>
<p style="font-size:16px">Check out some examples of groups playing together on JamKazam:</p>
<iframe width="625" height="400" src="https://www.youtube.com/embed/euxDykIqUdo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="col-md-4 col-sm-12">
<p>Sign up for a free account now and get <a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000122535-what-are-jamkazam-s-free-vs-premium-features-">Gold premium subscription</a> features FREE for 30 days! After 30 days you can continue playing on our free plan or select a premium plan whatever is right for you. When you sign up, well send you an email with instructions on how to set up and play on the platform.</p>
<%= errors_for @user %>
<%= form_for(@user, :url => @signup_postback, :method => :post, html: { id: 'signup' }) do |f| %>
<div class="row mb-2">
<div class="col-md-6 col-sm-12">
<%= f.label :first_name, "First Name:" %>
<%= f.text_field :first_name %>
</div>
<div class="col-md-6 col-sm-12">
<%= f.label :last_name, "Last Name:" %>
<%= f.text_field :last_name %>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<%= f.label :email, "Email Address:" %>
<%= f.text_field :email %>
</div>
</div>
<div class="row mb-2">
<div class="col-md-12">
<%= f.label :password, "Choose a Password:" %>
<%= f.password_field :password %>
</div>
</div>
<div class="row mb-2">
<div class="col-md-12">
<%= f.label :password_confirmation, "Verify Password:" %>
<%= f.password_field :password_confirmation %>
</div>
</div>
<div class="row mt-3">
<div class="col-12">
<%= f.check_box :terms_of_service %> <label for="user_terms_of_service" style="font-size: 90%">I agree to the JamKazam <%= link_to "terms of service", corp_terms_path, :rel => "external" %></label>
</div>
</div>
<div class="row mb-2">
<div class="col-12 recaptcha">
<% if Rails.application.config.recaptcha_enable %>
<div id="recaptcha_select" name="recaptcha_response_field" class="g-recaptcha" data-sitekey="<%=Rails.application.config.recaptcha_public_key%>" data-callback="recaptcha_success" data-expired-callback="recaptcha_expired">
</div>
<% end %>
</div>
</div>
<div class="row mb-2">
<div class="col-12"><br />
<button id="create-account-submit" onClick="$document.forms['signup'].submit()" style="width:100%">Sign Up for JamKazam</button>
</div>
</div>
<% end %>
</div>
</div>
<%= content_for(:scripts) do %>
<script type="text/javascript">
//window.signup.handle_location_changes()
// window.signup.handle_register_as_changes()
function recaptcha_success(response) {
//$("#create-account-submit").removeClass("disabled")
$("#create-account-submit").prop("disabled", false)
}
function recaptcha_expired(response) {
//$("#create-account-submit").addClass("disabled")
$("#create-account-submit").prop("disabled", true)
}
function get_first_error(field) {
if (errors[field] && errors[field].length > 0) {
return errors[field][0]
}
else {
return null;
}
}
// populate musician instruments from previous submit, if applicable
// if (window.gon && gon.musician_instruments) {
// $(gon.musician_instruments).each(function (index, value) {
// $('#' + value.instrument_id.replace(" ", "") + "_checkbox").attr("checked", true);
// $('#' + value.instrument_id.replace(" ", "") + "_proficiency").val(value.proficiency_level.toString())
// })
// }
// if(window.gon) {
// var $radios = $('input:radio[name="jam_ruby_user[desired_plan_code]"]');
// if(gon.plan_code) {
// $radios.filter(gon.plan_code, true)
// }
// else {
// $radios.filter('[value="<%= @plan_code %>"]').prop('checked', true)
// }
// }
// show signup errors, if any
if (window.gon && gon.signup_errors) {
var errors =
<%= @user.errors.to_json.html_safe %>
var email = get_first_error("email")
var first_name = get_first_error("first_name")
var last_name = get_first_error("last_name")
var musician_instruments = get_first_error("musician_instruments")
var password = get_first_error("password")
var password_confirmation = get_first_error("password_confirmation")
var terms_of_service = get_first_error("terms_of_service")
var country = get_first_error("country")
var state = get_first_error("state")
var city = get_first_error("city")
var recaptcha = get_first_error("recaptcha")
if (email) {
var emailInput = $('#jam_ruby_user_email');
emailInput.closest('div.field').addClass('error')
emailInput.after("<div class='error-text'>" + email + "</div>")
}
if (first_name) {
var firstNameInput = $('#jam_ruby_user_first_name');
firstNameInput.closest('div.field').addClass('error')
firstNameInput.after("<div class='error-text'>" + first_name + "</div>")
}
if (last_name) {
var lastNameInput = $('#jam_ruby_user_last_name');
lastNameInput.closest('div.field').addClass('error')
lastNameInput.after("<div class='error-text'>" + last_name + "</div>")
}
if (country) {
var countryInput = $('#country_select');
countryInput.closest('div.field').addClass('error')
countryInput.after("<div class='error-text'>" + country + "</div>")
}
if (state) {
var stateInput = $('#region_select');
stateInput.closest('div.field').addClass('error')
stateInput.after("<div class='error-text'>" + state + "</div>")
}
if (city) {
var cityInput = $('#city_select');
cityInput.closest('div.field').addClass('error')
cityInput.after("<div class='error-text'>" + city + "</div>")
}
if (recaptcha) {
var recaptchaInput = $('#recaptcha_select');
recaptchaInput.closest('div.field').addClass('error')
recaptchaInput.after("<div class='error-text'>" + recaptcha + "</div>")
}
if (musician_instruments) {
var musicianInstrumentsInput = $('#instrument_selector');
musicianInstrumentsInput.closest('div.ftue-instrumentlist-wrapper').addClass('error')
musicianInstrumentsInput.closest('div.ftue-instrumentlist').after("<div class='error-text'>" + musician_instruments + "</div>")
}
if (password) {
var passwordInput = $('#jam_ruby_user_password');
passwordInput.closest('div.field').addClass('error')
passwordInput.after("<div class='error-text'>" + password + "</div>")
}
if (password_confirmation) {
var passwordConfirmationInput = $('#jam_ruby_user_password_confirmation');
passwordConfirmationInput.closest('div.field').addClass('error')
passwordConfirmationInput.after("<div class='error-text'>" + password_confirmation + "</div>")
}
if (terms_of_service) {
var termsOfServiceInput = $('#jam_ruby_user_terms_of_service');
termsOfServiceInput.closest('small').addClass('error')
termsOfServiceInput.after("<div class='error-text'>" + terms_of_service + "</div>")
}
}
</script>
<% end %>

View File

@ -5,6 +5,7 @@
tests=(
"spec/features/signup_spec.rb"
"spec/features/signin_spec.rb"
"spec/features/download_spec.rb"
"spec/features/affiliate_program_spec.rb"
"spec/features/affiliate_visit_tracking_spec.rb"
"spec/features/affiliate_referral_spec.rb"

View File

@ -94,6 +94,7 @@ if defined?(Bundler)
config.assets.precompile += %w( basic/basic.js basic/basic.css )
config.assets.precompile += %w( events/events.js events/events.scss )
config.assets.precompile += %w( support/support.js support/support.scss )
config.assets.precompile += %w( jk2021/jk2021.js jk2021/jk2021.css )
# where is rabbitmq?
config.rabbitmq_host = "127.0.0.1"

View File

@ -70,6 +70,10 @@ Rails.application.routes.draw do
#get '/landing/jamclass/education', to: 'landings#jam_class_education', as: 'jam_class_education'
#get '/landing/jamclass/retailers', to: 'landings#jam_class_retailers', as: 'jam_class_retailers'
get '/landing/general/signup', to: "users#new"
post '/landing/general/signup', to: "users#create"
get '/landing/general/downloads', to: "users#downloads"
get '/affiliateProgram', to: 'landings#affiliate_program', as: 'affiliate_program'
get '/affiliate/links/:id', to: 'affiliates#links', as: 'affilate_links'

View File

@ -7,9 +7,9 @@ describe "Download", :js => true, :type => :feature, :capybara_feature => true
subject { page }
before(:all) do
Capybara.javascript_driver = :poltergeist
Capybara.current_driver = Capybara.javascript_driver
Capybara.default_max_wait_time = 10
#Capybara.javascript_driver = :poltergeist
#Capybara.current_driver = Capybara.javascript_driver
#Capybara.default_max_wait_time = 10
end
let(:user) { FactoryGirl.create(:user) }
@ -23,12 +23,11 @@ describe "Download", :js => true, :type => :feature, :capybara_feature => true
end
describe "downloads-page" do
shared_examples :dowload_client do
# there is also a generic download pages
before(:each) do
sign_in_poltergeist user
visit '/downloads'
#sign_in_poltergeist user
visit path
# put the user on Windows to start
detected_os = find("a.current-os-download")['data-platform']
@ -42,14 +41,54 @@ describe "Download", :js => true, :type => :feature, :capybara_feature => true
remaining_platform = platforms[0]
other_download.trigger(:click)
#other_download.trigger(:click)
other_download.click
find("a.current-os-download")['data-platform'].should == other_download_platform
find(".download-others a[data-platform='#{remaining_platform}']").trigger(:click)
#find(".download-others a[data-platform='#{remaining_platform}']").trigger(:click)
find(".download-others a[data-platform='#{remaining_platform}']").click
find("a.current-os-download")['data-platform'].should == remaining_platform
end
end
describe "goto downloads-page without signin" do
describe :default_downloads_page do
it_behaves_like :dowload_client do
let(:path){ "/downloads" }
end
it "renders web layout" do
visit "/downloads"
end
end
describe :landing_downloads_page do
it_behaves_like :dowload_client do
let(:path){ "/landing/general/downloads" }
end
end
end
describe "signin and goto downloads-page" do
before(:each) do
sign_in_poltergeist user
end
describe :default_downloads_page do
it_behaves_like :dowload_client do
let(:path){ "/downloads" }
end
end
describe :landing_downloads_page do
it_behaves_like :dowload_client do
let(:path){ "/landing/general/downloads" }
end
end
end
end
end

View File

@ -19,250 +19,440 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
MaxMindManager.create_phony_database
end
describe "with origin" do
# Successful signup with no invitation tells you to go sign up
it {
visit "/signup?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "withorigin1@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
click_button "CREATE ACCOUNT"
should have_title("JamKazam | Congratulations")
should have_content("Your account is ready.")
user = User.find_by_email('withorigin1@jamkazam.com')
user.musician_instruments.length.should == 1
location = GeoIpLocations.lookup('127.0.0.1')
user.country.should == location[:country]
user.state.should == location[:state]
user.city.should == location[:city]
# an email is sent on no-invite signup
user.origin_utm_source.should eql 'abc'
user.origin_utm_campaign.should eql 'campaign1'
user.origin_utm_medium.should eql 'ads'
user.origin_referrer.should be_nil
}
end
describe "signup page" do
before { visit signup_path }
it "should initialize successfully" do
should have_selector('h2.create-account-header', text: '1Create your free JamKazam account')
end
describe "with valid musician information" do
before do
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser1@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
click_button "CREATE ACCOUNT"
shared_examples_for :signup_with_origin do
describe "with origin" do
before(:each) do
User.delete_all
end
# Successful signup with no invitation tells you to go sign up
it {
should have_title("JamKazam | Congratulations")
should have_content("Your account is ready.")
user = User.find_by_email('newuser1@jamkazam.com')
user.musician_instruments.length.should == 1
location = GeoIpLocations.lookup('127.0.0.1')
user.country.should == location[:country]
user.state.should == location[:state]
user.city.should == location[:city]
# an email is sent on no-invite signup
UserMailer.deliveries.length.should == 2
UserMailer.deliveries[0].html_part.body.include?("To confirm this email address")== 1
}
describe "user can confirm email and receive welcome email" do
before(:each) do
UserMailer.deliveries.clear
visit signup_confirm_path(User.find_by_email('newuser1@jamkazam.com').signup_token)
end
it {
should have_title("Signup Confirmation")
should have_selector('h1', text: "Email Confirmed")
}
end
end
describe "with service invite" do
before do
@invited_user = FactoryGirl.create(:invited_user, :email => "noone@jamkazam.com", :sender => FactoryGirl.create(:user))
visit "#{signup_path}?invitation_code=#{@invited_user.invitation_code}"
find('#jam_ruby_user_first_name')
sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
UserMailer.deliveries.clear
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser2@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
click_button "CREATE ACCOUNT"
end
# Successful sign-in goes to the client
it {
should have_title("JamKazam")
should have_selector('.flash-content', text: "Soon you can play with #{@invited_user.sender.name}")
UserMailer.deliveries.length.should == 2
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => @invited_user.sender.name)
}
end
describe "with user invite and autofriend" do
before do
@user = FactoryGirl.create(:user)
@invited_user = FactoryGirl.create(:invited_user, :sender => @user, :autofriend => true, :email => "noone@jamkazam.com")
visit "#{signup_path}?invitation_code=#{@invited_user.invitation_code}"
find('#jam_ruby_user_first_name')
sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
#visit "/signup?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser3@jamkazam.com"
fill_in "jam_ruby_user[email]", with: "withorigin1@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
click_button "CREATE ACCOUNT"
end
# Successful sign-in goes to the client
it {
should have_title("JamKazam")
should have_selector('.flash-content', text: "Soon you can play with #{@invited_user.sender.name}")
@user.friends?(User.find_by_email("newuser3@jamkazam.com"))
User.find_by_email("newuser3@jamkazam.com").friends?(@user)
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => @invited_user.sender.name)
#click_button "CREATE ACCOUNT"
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
should have_title("JamKazam | Congratulations")
should have_content("Your account is ready.")
user = User.find_by_email('withorigin1@jamkazam.com')
user.musician_instruments.length.should == 1
location = GeoIpLocations.lookup('127.0.0.1')
user.country.should == location[:country]
user.state.should == location[:state]
user.city.should == location[:city]
# an email is sent on no-invite signup
user.origin_utm_source.should eql 'abc'
user.origin_utm_campaign.should eql 'campaign1'
user.origin_utm_medium.should eql 'ads'
user.origin_referrer.should be_nil
}
end
end
shared_examples :page_load_success do
it "should initialize successfully" do
expect(page).to have_title "JamKazam | Register"
end
end
def signup_invited_user
visit "#{signup_path}?invitation_code=#{@invited_user.invitation_code}"
shared_examples :default_signup_page do
it "has default signup page content" do
should have_content(/Live music platform/)
end
end
shared_examples :landing_signup_page do
it "has landing signup page content" do
should have_content(/JamKazam has spent the last 6 years/)
end
end
shared_examples :submit_signup_form do
before do
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser1@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
end
# Successful signup with no invitation tells you to go sign up
it {
should have_title("JamKazam | Congratulations")
should have_content("Your account is ready.")
user = User.find_by_email('newuser1@jamkazam.com')
user.musician?.should == true
user.musician_instruments.length.should == 1
location = GeoIpLocations.lookup('127.0.0.1')
user.country.should == location[:country]
user.state.should == location[:state]
user.city.should == location[:city]
# an email is sent on no-invite signup
UserMailer.deliveries.length.should == 2
UserMailer.deliveries[0].html_part.body.include?("To confirm this email address")== 1
}
describe "user can confirm email and receive welcome email" do
before(:each) do
UserMailer.deliveries.clear
visit signup_confirm_path(User.find_by_email('newuser1@jamkazam.com').signup_token)
end
it {
should have_title("Signup Confirmation")
should have_selector('h1', text: "Email Confirmed")
}
end
end
shared_examples :submit_signup_form_with_errors do
before do
#submit without filling the form
find("#create-account-submit").click
end
# Successful signup with no invitation tells you to go sign up
it {
should_not have_title("JamKazam | Congratulations")
}
end
shared_examples :with_user_invite do
let(:invited_user) { FactoryGirl.create(:invited_user, :email => "noone@jamkazam.com", :sender => FactoryGirl.create(:user)) }
before do
visit "#{path}?invitation_code=#{invited_user.invitation_code}"
find('#jam_ruby_user_first_name')
sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
UserMailer.deliveries.clear
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser2@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
end
# Successful sign-in goes to the client
it {
should have_title("JamKazam")
should have_selector('.flash-content', text: "Soon you can play with #{invited_user.sender.name}")
UserMailer.deliveries.length.should == 2
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => invited_user.sender.name)
}
end
shared_examples :with_user_invite_and_autofriend do
before(:each) do
User.destroy_all
InvitedUser.destroy_all
@user = FactoryGirl.create(:user)
@invited_user = FactoryGirl.create(:invited_user, :sender => @user, :autofriend => true, :email => "noone@jamkazam.com")
visit "#{path}?invitation_code=#{@invited_user.invitation_code}"
find('#jam_ruby_user_first_name')
sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
@invited_user_email = "newuser#{rand(10000)}@jamkazam.com"
fill_in "jam_ruby_user[email]", with: @invited_user_email
fill_in "jam_ruby_user[email]", with: "newuser3@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
click_button "CREATE ACCOUNT"
end
describe "can signup with an email different than the one used to invite" do
before do
@invited_user = FactoryGirl.create(:invited_user, :email => "what@jamkazam.com", :sender => FactoryGirl.create(:user))
visit "#{signup_path}?invitation_code=#{@invited_user.invitation_code}"
find('#jam_ruby_user_first_name')
sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
UserMailer.deliveries.clear
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser5@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
click_button "CREATE ACCOUNT"
end
it {
should have_title("JamKazam | Congratulations")
should have_selector('.flash-content', text: "Soon you can play with #{@invited_user.sender.name}")
User.find_by_email('newuser5@jamkazam.com').musician_instruments.length.should == 1
User.find_by_email('what@jamkazam.com').should be_nil
# an email is sent when you invite but use a different email than the one used to invite
UserMailer.deliveries.length.should == 2
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => @invited_user.sender.name)
sign_out
}
end
describe "signup_hints" do
it "redirects to custom location on matched signup_hint" do
# causes anon cookie to show
visit '/'
find('h2', text: 'Play music live and in sync with others from different locations')
# get a anonymous cookie set up
anon_user_id = get_me_the_cookie("user_uuid")
puts "#ANON_USER_ID #{anon_user_id.inspect}"
anon_user = AnonymousUser.new(anon_user_id[:value], {})
SignupHint.refresh_by_anoymous_user(anon_user, {redirect_location: '/affiliateProgram'})
visit signup_path
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "signup_hint_guy@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
click_button "CREATE ACCOUNT"
find('h1', text:'JamKazam Affiliate Program')
user = User.find_by_email('signup_hint_guy@jamkazam.com')
user.should_not be_nil
end
it "ignores expired_at signup_hint" do
# causes anon cookie to show
visit '/'
find('h2', text: 'Play music live and in sync with others from different locations')
# get a anonymous cookie set up
anon_user_id = get_me_the_cookie("user_uuid")
anon_user = AnonymousUser.new(anon_user_id[:value], {})
hint = SignupHint.refresh_by_anoymous_user(anon_user, {redirect_location: '/products/jamblaster', want_jamblaster: true})
hint.expires_at = 1.day.ago
hint.save!
visit signup_path
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "signup_hint_guy2@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
click_button "CREATE ACCOUNT"
should have_title("JamKazam | Congratulations")
user = User.find_by_email('signup_hint_guy2@jamkazam.com')
user.want_jamblaster.should be false
end
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
end
# Successful sign-in goes to the client
it {
should have_title("JamKazam")
should have_selector('.flash-content', text: "Soon you can play with #{@invited_user.sender.name}")
@user.friends?(User.find_by_email("newuser3@jamkazam.com"))
User.find_by_email("newuser3@jamkazam.com").friends?(@user)
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => @invited_user.sender.name)
}
end
shared_examples :with_different_email do
let(:invited_user) { FactoryGirl.create(:invited_user, :email => "what@jamkazam.com", :sender => FactoryGirl.create(:user)) }
before do
visit "#{path}?invitation_code=#{invited_user.invitation_code}"
find('#jam_ruby_user_first_name')
sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
UserMailer.deliveries.clear
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser5@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
end
it {
should have_title("JamKazam | Congratulations")
should have_selector('.flash-content', text: "Soon you can play with #{invited_user.sender.name}")
User.find_by_email('newuser5@jamkazam.com').musician_instruments.length.should == 1
User.find_by_email('what@jamkazam.com').should be_nil
# an email is sent when you invite but use a different email than the one used to invite
UserMailer.deliveries.length.should == 2
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => invited_user.sender.name)
sign_out
}
end
shared_examples :signup_hints do
it "redirects to custom location on matched signup_hint" do
# causes anon cookie to show
visit '/'
find('h2', text: 'Play music live and in sync with others from different locations')
# get a anonymous cookie set up
anon_user_id = get_me_the_cookie("user_uuid")
puts "#ANON_USER_ID #{anon_user_id.inspect}"
anon_user = AnonymousUser.new(anon_user_id[:value], {})
SignupHint.refresh_by_anoymous_user(anon_user, {redirect_location: '/affiliateProgram'})
visit path
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "signup_hint_guy@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
find('h1', text:'JamKazam Affiliate Program')
user = User.find_by_email('signup_hint_guy@jamkazam.com')
user.should_not be_nil
end
it "ignores expired_at signup_hint" do
# causes anon cookie to show
visit '/'
find('h2', text: 'Play music live and in sync with others from different locations')
# get a anonymous cookie set up
anon_user_id = get_me_the_cookie("user_uuid")
anon_user = AnonymousUser.new(anon_user_id[:value], {})
hint = SignupHint.refresh_by_anoymous_user(anon_user, {redirect_location: '/products/jamblaster', want_jamblaster: true})
hint.expires_at = 1.day.ago
hint.save!
visit path
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "signup_hint_guy2@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
should have_title("JamKazam | Congratulations")
user = User.find_by_email('signup_hint_guy2@jamkazam.com')
user.want_jamblaster.should be false
end
end
describe "with origin" do
describe :default_signup do
before do
visit "/signup?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
end
it_behaves_like :signup_with_origin
it_behaves_like :default_signup_page
end
describe :landing_signup do
before do
visit "/landing/general/signup?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
end
it_behaves_like :signup_with_origin
it_behaves_like :landing_signup_page
end
end
describe "signup form" do
before(:each) do
User.destroy_all
end
describe :default_signup do
before do
visit signup_path
end
it_behaves_like :page_load_success
it_behaves_like :submit_signup_form
it_behaves_like :default_signup_page
end
describe :landing_signup do
before do
visit "/landing/general/signup"
end
it_behaves_like :page_load_success
it_behaves_like :submit_signup_form
it_behaves_like :landing_signup_page
end
end
describe "signup form with errors" do
before(:each) do
User.destroy_all
end
describe :default_signup do
before do
visit signup_path
end
it_behaves_like :page_load_success
it_behaves_like :submit_signup_form_with_errors
it_behaves_like :default_signup_page
end
describe :landing_signup do
before do
visit "/landing/general/signup"
end
it_behaves_like :page_load_success
it_behaves_like :submit_signup_form_with_errors
it_behaves_like :landing_signup_page
end
end
describe "with user invite" do
before(:each) do
User.destroy_all
end
describe :default_signup do
it_behaves_like :with_user_invite do
let(:path){ "/signup" }
end
end
describe :landing_signup do
it_behaves_like :with_user_invite do
let(:path){ "/landing/general/signup" }
end
end
end
describe "with user invite and autofriend" do
describe :default_signup do
it_behaves_like :with_user_invite_and_autofriend do
let(:path){ "/signup" }
end
end
describe :landing_signup do
it_behaves_like :with_user_invite_and_autofriend do
let(:path){ "/landing/general/signup" }
end
end
end
describe "can signup with an email different than the one used to invite" do
before(:each) do
User.destroy_all
end
describe :default_signup do
it_behaves_like :with_different_email do
let(:path){ "/signup" }
end
end
describe :landing_signup do
it_behaves_like :with_different_email do
let(:path){ "/landing/general/signup" }
end
end
end
describe "signup_hints" do
before(:each) do
User.destroy_all
end
describe :default_signup do
it_behaves_like :signup_hints do
let(:path){ "/signup" }
end
end
describe :landing_signup do
it_behaves_like :signup_hints do
let(:path){ "/landing/general/signup" }
end
end
end
# def signup_invited_user
# visit "#{signup_path}?invitation_code=#{@invited_user.invitation_code}"
# find('#jam_ruby_user_first_name')
# sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
# fill_in "jam_ruby_user[first_name]", with: "Mike"
# fill_in "jam_ruby_user[last_name]", with: "Jones"
# @invited_user_email = "newuser#{rand(10000)}@jamkazam.com"
# fill_in "jam_ruby_user[email]", with: @invited_user_email
# fill_in "jam_ruby_user[password]", with: "jam123"
# fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
# check("jam_ruby_user[terms_of_service]")
# #click_button "Sign Up for JamKazam"
# find("#create-account-submit").click
# end
end