better education interest screen

This commit is contained in:
Seth Call 2016-09-23 08:24:42 -05:00
parent 8760924e59
commit eb89ea0a43
5 changed files with 34 additions and 6 deletions

View File

@ -12,7 +12,7 @@ rest = context.JK.Rest()
ctaButtonText = 'hold on...'
else
if loggedIn
ctaButtonText = "SIGN UP"
ctaButtonText = "SET UP SCHOOL"
else
ctaButtonText = "SIGN UP"
@ -131,10 +131,10 @@ rest = context.JK.Rest()
markTeacher: () ->
rest.updateUser({school_interest: true})
rest.updateUser({school_interest: true,education_interest: true})
.done((response) =>
this.setState({done: true})
context.location = '/client#/home'
context.location = '/client#/account/school'
)
.fail((jqXHR) =>
this.setState({processing: false})
@ -157,7 +157,10 @@ rest = context.JK.Rest()
education_interest: true
})
.done((response) =>
context.location = '/client#/home'
if response.autologin
context.location = '/client#/account/school'
else
context.location = '/client#/home'
).fail((jqXHR) =>
@setState({processing: false})
if jqXHR.status == 422

View File

@ -84,6 +84,23 @@ class ApiUsersController < ApiController
# recaptcha_response: params['g-recaptcha-response']
# try to autologin , because users will try to log in via signup link
if(params[:email] && params[:password])
test = User.authenticate(params[:email], params[:password])
if test
@user = test
@autologin = true
@user.school_interest = !!params[:school_interest]
@user.education_interest = !!params[:education_interest]
@user.save
sign_in @user
new_user(@user, signup_hint) # sets a cookie used for GA analytics (one-time new user stuff in JavaScript)
respond_with_model(@user, new: true, location: lambda { return api_user_detail_url(@user.id) })
return
end
end
options = {
first_name: params[:first_name],
last_name: params[:last_name],
@ -187,6 +204,7 @@ class ApiUsersController < ApiController
@user.is_a_student = params[:student] if params.has_key?(:student)
@user.is_a_teacher = params[:teacher] if params.has_key?(:teacher)
@user.school_interest = !!params[:school_interest]
@user.education_interest = !!params[:education_interest]
@user.desired_package = LessonPackageType.find_by_package_type!(params[:desired_package]) if params.has_key?(:desired_package)
if @user.save

View File

@ -402,7 +402,7 @@ class LandingsController < ApplicationController
@show_approved_only = true
# isn't working. totaly hack:
@school.teachers = @school.approved_teachers
@school.teachers = @school.approved_teachersL
schoolRabl = Rabl::Renderer.json(@school, 'api_schools/show')
@page_data = {school: @school, preview: @preview, rabl: schoolRabl}

View File

@ -25,6 +25,12 @@ if @show_profile
end
end
if @autologin
node :autologin do
true
end
end
# give back more info if the user being fetched is yourself
if current_user && @user == current_user

View File

@ -102,7 +102,8 @@ SampleApp::Application.configure do
config.time_shift_style = :sox # or sbsms
config.vst_enabled = true
config.verify_email_enabled = true
config.verify_email_enabled = false
config.jamclass_enabled = true
config.jamblaster_menu = true
config.recaptcha_enable = false
end