From 853d359a7e96608c1c69e1e32319ead09a83025a Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 6 Feb 2016 17:32:20 -0600 Subject: [PATCH] * VRFS-3919 - teacher testdrive settings in on pricing profile --- db/manifest | 3 +- db/up/test_drive_lessons.sql | 2 + ruby/lib/jam_ruby/models/teacher.rb | 5 +- web/app/assets/javascripts/dialog/banner.js | 2 - web/app/assets/javascripts/layout.js | 8 ++- .../TeacherSetupPricing.js.jsx.coffee | 68 ++++++++++++++++--- .../stylesheets/client/teachers.css.scss | 17 +++++ web/app/views/api_teachers/detail.rabl | 2 + web/app/views/dialogs/_banner.html.slim | 2 +- web/config/application.rb | 1 + web/config/initializers/gon.rb | 1 + 11 files changed, 95 insertions(+), 16 deletions(-) create mode 100644 db/up/test_drive_lessons.sql 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 `
@@ -277,6 +308,23 @@ rest = window.JK.Rest() {priceRows} +
+

TestDrive Program:

+ +
+ + +
+ 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. learn more about TestDrive +
+
+
+
` diff --git a/web/app/assets/stylesheets/client/teachers.css.scss b/web/app/assets/stylesheets/client/teachers.css.scss index 9178b6100..a0b3b1652 100644 --- a/web/app/assets/stylesheets/client/teachers.css.scss +++ b/web/app/assets/stylesheets/client/teachers.css.scss @@ -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; + } } \ No newline at end of file diff --git a/web/app/views/api_teachers/detail.rabl b/web/app/views/api_teachers/detail.rabl index 6811f9284..5941f00c1 100644 --- a/web/app/views/api_teachers/detail.rabl +++ b/web/app/views/api_teachers/detail.rabl @@ -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 diff --git a/web/app/views/dialogs/_banner.html.slim b/web/app/views/dialogs/_banner.html.slim index fe406d529..78cfb69c4 100644 --- a/web/app/views/dialogs/_banner.html.slim +++ b/web/app/views/dialogs/_banner.html.slim @@ -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" diff --git a/web/config/application.rb b/web/config/application.rb index 6201a4c4e..5275a0a52 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -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 diff --git a/web/config/initializers/gon.rb b/web/config/initializers/gon.rb index d58d5fa10..50651d0e5 100644 --- a/web/config/initializers/gon.rb +++ b/web/config/initializers/gon.rb @@ -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