* VRFS-3919 - teacher testdrive settings in on pricing profile

This commit is contained in:
Seth Call 2016-02-06 17:32:20 -06:00
parent 7fc4376236
commit 853d359a7e
11 changed files with 95 additions and 16 deletions

View File

@ -329,4 +329,5 @@ reviews.sql
download_tracker_fingerprints.sql
connection_active.sql
chat_channel.sql
jamblaster.sql
jamblaster.sql
test_drive_lessons.sql

View File

@ -0,0 +1,2 @@
ALTER TABLE teachers ADD COLUMN test_drives_per_week INTEGER NOT NULL DEFAULT 2;
ALTER TABLE teachers ADD COLUMN teaches_test_drive BOOLEAN NOT NULL DEFAULT TRUE;

View File

@ -21,7 +21,8 @@ module JamRuby
validates :introductory_video, :format=> {:with=> /^(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?([\w-]{10,})/, message: "is not a valid youtube URL"}, :allow_blank => true, :if => :validate_introduction
validates :years_teaching, :presence => true, :if => :validate_introduction
validates :years_playing, :presence => true, :if => :validate_introduction
validates :teaches_test_drive, inclusion: {in: [true, false]}, :if => :validate_pricing
validates :test_drives_per_week, numericality: {only_integer: true, minimum: 2, maximum: 10}, :if => :validate_pricing
validates :instruments, :length => { minimum:1, message:"At least one instrument or subject is required"}, if: :validate_basics, unless: ->(teacher){teacher.subjects.length>0}
validates :subjects, :length => { minimum:1, message:"At least one instrument or subject is required"}, if: :validate_basics, unless: ->(teacher){teacher.instruments.length>0}
validates :genres, :length => { minimum:1, message:"At least one genre is required"}, if: :validate_basics
@ -173,6 +174,8 @@ module JamRuby
teacher.price_per_month_60_cents = params[:price_per_month_60_cents] if params.key?(:price_per_month_60_cents)
teacher.price_per_month_90_cents = params[:price_per_month_90_cents] if params.key?(:price_per_month_90_cents)
teacher.price_per_month_120_cents = params[:price_per_month_120_cents] if params.key?(:price_per_month_120_cents)
teacher.teaches_test_drive = params[:teaches_test_drive] if params.key?(:teaches_test_drive)
teacher.test_drives_per_week = params[:test_drives_per_week] if params.key?(:test_drives_per_week)
# Many-to-many relations:
if params.key?(:genres)

View File

@ -92,7 +92,6 @@
}
if(options.no_show) {
$buttons.addClass('center')
$noShowCheckbox.data('no_show', options.no_show)
$noShow.show()
}
@ -170,7 +169,6 @@
$banner.find('.user-btn').remove();
$('#banner_overlay .dialog-inner').html("");
$('#banner_overlay').hide();
$buttons.removeClass('center')
$noShowCheckbox.data('no_show', null).iCheck('uncheck').attr('checked', false)
$buttons.children().hide();
}

View File

@ -78,7 +78,13 @@
}
function setInitialExpandedSidebarPanel() {
expandedPanel = 'panelFriends';
if (gon.global.chat_opened_by_default) {
expandedPanel = 'panelChat';
}
else {
expandedPanel = 'panelFriends';
}
}
function layout() {

View File

@ -24,19 +24,24 @@ rest = window.JK.Rest()
componentDidUpdate: () ->
@updateCheckboxState()
@updateSingleCheckbox('teaches_test_drive', @state.teaches_test_drive)
@enableCheckBoxTargets()
updateCheckboxState: () ->
for minutes in [30, 45, 60, 90, 120]
priceKey = "lesson_duration_#{minutes}"
enabled = @state[priceKey]
containerName = ".#{priceKey}_container input[type='checkbox']"
@iCheckIgnore = true
if enabled
@root.find(containerName).iCheck('check').attr('checked', true);
else
@root.find(containerName).iCheck('uncheck').attr('checked', false);
@iCheckIgnore = false
@updateSingleCheckbox(priceKey, enabled)
updateSingleCheckbox: (priceKey, enabled) ->
containerName = ".#{priceKey}_container input[type='checkbox']"
@iCheckIgnore = true
if enabled
@root.find(containerName).iCheck('check').attr('checked', true);
else
@root.find(containerName).iCheck('uncheck').attr('checked', false);
@iCheckIgnore = false
enableCheckBoxTargets: (e) ->
checkboxes = @root.find('input[type="checkbox"]')
@ -78,6 +83,8 @@ rest = window.JK.Rest()
lesson_duration_60: teacher.lesson_duration_60
lesson_duration_90: teacher.lesson_duration_90
lesson_duration_120: teacher.lesson_duration_120
test_drives_per_week: teacher.test_drives_per_week,
teaches_test_drive: teacher.teaches_test_drive
})
false
@ -124,14 +131,26 @@ rest = window.JK.Rest()
else if instructions.direction=="back"
navTo = @teacherSetupDestination("experience")
else if instructions.direction=="next"
# We are done:
navTo = @teacherSetupSource()
# prevent any action if the user has unselected teach test drive...
if !this.state.teaches_test_drive
@setState({teaches_test_drive: true})
context.JK.Banner.showAlert('Test Drive Participation Required', "In order to participate in the JamClass online music lesson marketplace by JamKazam, you must be willing to teach at least 2 TestDrive classes per week, ideally more if you want to attract more new students. <br/><br/>TestDrive is the primary means by which JamKazam connects new students to teachers, so if you don't do this, the marketplace will really not help you. <br /><br />If you feel that you have a compelling reason not to give TestDrive lessons, but still want to participate in our marketplace, then please send us an email at support@jamkazam.com to chat with us about it.")
navTo = 'rejected'
else
# We are done:
navTo = @teacherSetupSource()
navTo
handleNav: (e) ->
navTo = this.navDestination(e)
teacherActions.change.trigger(this.state, {navTo: navTo})
if navTo == 'rejected'
# do nothing...handled elsewhere
else
teacherActions.change.trigger(this.state, {navTo: navTo})
handleFocus: (e) ->
@pricePerLessonCents=e.target.value
@ -145,6 +164,15 @@ rest = window.JK.Rest()
return
this.setState({"#{e.target.name}": e.target.checked})
handleTestDriveCountChange: (e) ->
$this = $(e.target)
value = $this.val()
this.setState({test_drives_per_week: new Number(value)})
handleLearnMoreAboutTestDrive: (e) ->
e.preventDefault()
alert("Help documentation coming soon!")
render: () ->
priceRows = []
for minutes in [30, 45, 60, 90, 120]
@ -177,6 +205,9 @@ rest = window.JK.Rest()
perMonthInputStyles = classNames({"per-month-target" : true, disabled: !monthlyEnabled})
perLessonInputStyles = classNames({"per-lesson-target": true, disabled: !lessonEnabled})
test_drive_lessons = []
for i in [2..10]
test_drive_lessons.push(`<option value={i} key={i}>{i}</option>`)
priceRows.push `
<div className="teacher-price-row" key={minutes}>
@ -277,6 +308,23 @@ rest = window.JK.Rest()
{priceRows}
<div className="teacher-price-row">
<h3 className="margined">TestDrive Program:</h3>
<div className="teacher-field teaches_test_drive_container">
<input type='checkbox' className='checkbox-enabler' name="teaches_test_drive" checked={this.state.teaches_test_drive} ref="teaches_test_drive" onChange={this.handleCheckChange}></input>
<label htmlFor='test_drives_per_week' className="checkbox-label">I agree to teach up to
<select name="test_drives_per_week" className="test_drives_per_week" value={this.state.test_drives_per_week} onChange={this.handleTestDriveCountChange}>{test_drive_lessons}</select>
TestDrive lessons per week</label>
<div className="test-drive-explain">
TestDrive is the primary marketing program JamKazam uses to drive new students through our marketplace to teachers.
You will be paid $10 per 30-minute TestDrive lesson that you teach. Each time you teach a TestDrive lesson, it is with a student
who has an interest in taking online music lessons through the JamClass service, so you have a solid chance to convert the TestDrive
lesson into a long-term teacher-student relationship. <a className="learn-more-about-test-drive" onClick={this.handleLearnMoreAboutTestDrive}>learn more about TestDrive</a>
</div>
</div>
</div>
<br className="clearall"/>
<TeacherSetupNav handleNav={this.handleNav} last={true}></TeacherSetupNav>
</div>`

View File

@ -369,4 +369,21 @@
margin: 8px 4px 8px 0px;
text-transform: uppercase;
}
.test-drive-explain {
margin-top:20px;
line-height:125%;
}
.teacher-field.teaches_test_drive_container {
select {
margin:0 7px;
width:auto;
display:inline-block;
}
}
.learn-more-about-test-drive {
margin-left:50px;
}
}

View File

@ -32,6 +32,8 @@ attributes :id,
:website,
:years_playing,
:years_teaching,
:teaches_test_drive,
:test_drives_per_week,
:errors
child :review_summary => :review_summary do

View File

@ -8,7 +8,7 @@
br.end-content clear='all'
.right.buttons
.center.buttons
a.button-orange.close-btn CLOSE
.no-more-show
input.no-more-show-checkbox type="checkbox"

View File

@ -416,5 +416,6 @@ if defined?(Bundler)
config.kickbox_api_key = 'e262991e292dd5fe382c4a69f2b359f718cf267712b8684c9c28d6402ec18965'
config.check_bounced_emails = false
config.ban_jamtrack_downloaders = true
config.chat_opened_by_default = true
end
end

View File

@ -23,4 +23,5 @@ Gon.global.jamtrack_browser_bubbles_enabled = Rails.application.config.jamtrack_
Gon.global.bugsnag_key = Rails.application.config.bugsnag_key
Gon.global.bugsnag_notify_release_stages = Rails.application.config.bugsnag_notify_release_stages
Gon.global.vst_enabled = Rails.application.config.vst_enabled
Gon.global.chat_opened_by_default = Rails.application.config.chat_opened_by_default
Gon.global.env = Rails.env