diff --git a/db/manifest b/db/manifest
index c3312734b..be7e53729 100755
--- a/db/manifest
+++ b/db/manifest
@@ -329,4 +329,5 @@ reviews.sql
download_tracker_fingerprints.sql
connection_active.sql
chat_channel.sql
-jamblaster.sql
\ No newline at end of file
+jamblaster.sql
+test_drive_lessons.sql
\ No newline at end of file
diff --git a/db/up/test_drive_lessons.sql b/db/up/test_drive_lessons.sql
new file mode 100644
index 000000000..bac4f76eb
--- /dev/null
+++ b/db/up/test_drive_lessons.sql
@@ -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;
\ No newline at end of file
diff --git a/ruby/lib/jam_ruby/models/teacher.rb b/ruby/lib/jam_ruby/models/teacher.rb
index 690c6cce2..387a4757c 100644
--- a/ruby/lib/jam_ruby/models/teacher.rb
+++ b/ruby/lib/jam_ruby/models/teacher.rb
@@ -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)
diff --git a/web/app/assets/javascripts/dialog/banner.js b/web/app/assets/javascripts/dialog/banner.js
index 431152e2d..8121ad28f 100644
--- a/web/app/assets/javascripts/dialog/banner.js
+++ b/web/app/assets/javascripts/dialog/banner.js
@@ -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();
}
diff --git a/web/app/assets/javascripts/layout.js b/web/app/assets/javascripts/layout.js
index 19a25056c..c552750a3 100644
--- a/web/app/assets/javascripts/layout.js
+++ b/web/app/assets/javascripts/layout.js
@@ -78,7 +78,13 @@
}
function setInitialExpandedSidebarPanel() {
- expandedPanel = 'panelFriends';
+ if (gon.global.chat_opened_by_default) {
+ expandedPanel = 'panelChat';
+ }
+ else {
+ expandedPanel = 'panelFriends';
+ }
+
}
function layout() {
diff --git a/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee b/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee
index 8eb561216..734a8692d 100644
--- a/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee
+++ b/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee
@@ -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.
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.
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(``)
priceRows.push `