From dd84a3ebf7accf17c22b9536c497022e9fc3f1e2 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 26 Apr 2016 22:22:49 -0500 Subject: [PATCH] remove influxdb as dependency to ruby project --- admin/app/admin/students.rb | 9 +- ruby/Gemfile | 2 +- ruby/lib/jam_ruby/lib/stats.rb | 2 +- ruby/lib/jam_ruby/models/instrument.rb | 2 +- ruby/lib/jam_ruby/models/lesson_booking.rb | 1 - .../models/lesson_session_monthly_price.rb | 3 - ruby/lib/jam_ruby/models/user.rb | 2 +- .../assets/javascripts/accounts_profile.js | 19 ++-- .../accounts_profile_experience.js | 4 - .../assets/javascripts/helpBubbleHelper.js | 26 +++++- .../JamClassScreen.js.jsx.coffee | 86 +++++++------------ .../TeacherProfile.js.jsx.coffee | 43 +++++----- web/app/assets/javascripts/selectLocation.js | 31 ++----- web/app/assets/javascripts/utils.js | 5 +- .../assets/stylesheets/client/common.css.scss | 17 ++++ .../assets/stylesheets/client/help.css.scss | 20 +++++ .../react-components/JamClassScreen.css.scss | 24 +++++- .../react-components/TeacherProfile.css.scss | 25 ++++-- .../react-components/TeacherSearch.css.scss | 2 + web/app/views/api_users/show.rabl | 2 +- .../views/clients/_account_profile.html.erb | 4 +- .../_account_profile_experience.html.erb | 3 + web/app/views/clients/_help.html.slim | 9 +- .../book_monthly_recurring_lesson_spec.rb | 26 ++++-- .../features/book_recurring_lesson_spec.rb | 7 ++ 25 files changed, 218 insertions(+), 156 deletions(-) diff --git a/admin/app/admin/students.rb b/admin/app/admin/students.rb index a022aa727..75c099455 100644 --- a/admin/app/admin/students.rb +++ b/admin/app/admin/students.rb @@ -6,12 +6,13 @@ ActiveAdmin.register JamRuby::User, :as => 'Students' do config.batch_actions = false config.per_page = 100 config.paginate = true + config.filters = false - def booked_anything(scope) + def booked_anything(scope) scope.joins(:student_lesson_bookings).where('lesson_bookings.active = true').uniq end - scope("Default", default: true) { |scope| booked_anything(scope).order('ready_for_session_at IS NULL DESC') } + scope("Default", default: true) { |scope| scope.where('is_a_student = true OR ((select count(id) from lesson_bookings where lesson_bookings.user_id = users.id) > 0)').order('users.ready_for_session_at IS NULL DESC') } index do column "Name" do |user| @@ -45,8 +46,8 @@ ActiveAdmin.register JamRuby::User, :as => 'Students' do end end column "School" do |user| - if teacher.school - teacher.school.name + if user.school + user.school.name end end end diff --git a/ruby/Gemfile b/ruby/Gemfile index 27fdc30a6..03fd91455 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -49,7 +49,7 @@ gem 'rest-client' gem 'iso-639' gem 'rubyzip' gem 'sanitize' -gem 'influxdb' +#gem 'influxdb' gem 'recurly' gem 'sendgrid_toolkit', '>= 1.1.1' gem 'stripe' diff --git a/ruby/lib/jam_ruby/lib/stats.rb b/ruby/lib/jam_ruby/lib/stats.rb index a687f00a7..69020c5ce 100644 --- a/ruby/lib/jam_ruby/lib/stats.rb +++ b/ruby/lib/jam_ruby/lib/stats.rb @@ -1,5 +1,5 @@ -require 'influxdb' +#require 'influxdb' # monkey patch InfluxDB client to clear the queue when asked to stop =begin diff --git a/ruby/lib/jam_ruby/models/instrument.rb b/ruby/lib/jam_ruby/models/instrument.rb index 3f11a01e5..be18c5eb5 100644 --- a/ruby/lib/jam_ruby/models/instrument.rb +++ b/ruby/lib/jam_ruby/models/instrument.rb @@ -47,7 +47,7 @@ module JamRuby has_and_belongs_to_many :teachers, :class_name => "JamRuby::Teacher", :join_table => "teachers_instruments" def self.standard_list - return Instrument.where('instruments.popularity > 0').order('instruments.popularity DESC, instruments.description ASC') + return Instrument.where('instruments.popularity > 0').order('instruments.description ASC') end def self.jam_track_list diff --git a/ruby/lib/jam_ruby/models/lesson_booking.rb b/ruby/lib/jam_ruby/models/lesson_booking.rb index 713882015..b42d72be9 100644 --- a/ruby/lib/jam_ruby/models/lesson_booking.rb +++ b/ruby/lib/jam_ruby/models/lesson_booking.rb @@ -264,7 +264,6 @@ module JamRuby start_day = first_day if last_session - puts "last session causing a scoot" start_day = last_session.scheduled_start.to_date + 1 end diff --git a/ruby/lib/jam_ruby/models/lesson_session_monthly_price.rb b/ruby/lib/jam_ruby/models/lesson_session_monthly_price.rb index f1f667549..b2eae100c 100644 --- a/ruby/lib/jam_ruby/models/lesson_session_monthly_price.rb +++ b/ruby/lib/jam_ruby/models/lesson_session_monthly_price.rb @@ -17,12 +17,9 @@ module JamRuby true_start = session.scheduled_start.to_date end - puts "filter out anything before start #{true_start}" # filter out anything before the start day times.select! { |time| time.to_date >= true_start } - puts "times #{times.length}" - result = nil if times.length == 0 result = 0 diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index e9f287d3b..849828f8f 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -101,7 +101,7 @@ module JamRuby has_many :followers, :as => :followable, :class_name => "JamRuby::Follow", :dependent => :destroy # text messages - has_many :text_messages, :class_name => "JamRuby:TextMessage", :foreign_key => "target_user_id" + has_many :text_messages, :class_name => "JamRuby::TextMessage", :foreign_key => "target_user_id" # notifications has_many :notifications, :class_name => "JamRuby::Notification", :foreign_key => "target_user_id" diff --git a/web/app/assets/javascripts/accounts_profile.js b/web/app/assets/javascripts/accounts_profile.js index 99b6581cf..e9a874de8 100644 --- a/web/app/assets/javascripts/accounts_profile.js +++ b/web/app/assets/javascripts/accounts_profile.js @@ -44,6 +44,12 @@ } resetForm(); renderAccountProfile(); + + setTimeout(function() { + var $header = $('#account-edit-profile-form h2') + console.log("header ", $header, $screen) + context.JK.HelpBubbleHelper.teacherMusicianProfile($header, $screen); + }, 2000) } function resetForm() { @@ -80,8 +86,6 @@ $('select#user_birth_date_2i', content_root).val(parseInt(birthDateMonth)); $('select#user_birth_date_3i', content_root).val(parseInt(birthDateDay)); } - - context.JK.dropdown($('select', content_root)); } function populateAccountProfileLocation(userDetail, regions, cities) { @@ -126,8 +130,6 @@ countrySelect.val(userCountry); countrySelect.attr("disabled", null) - - context.JK.dropdown(countrySelect); } @@ -169,8 +171,6 @@ countrySelect.val(userCountry); countrySelect.attr("disabled", null); - - context.JK.dropdown(countrySelect); } function populateRegions(regions, userRegion) { @@ -193,8 +193,6 @@ regionSelect.val(userRegion) regionSelect.attr("disabled", null) - - context.JK.dropdown(regionSelect); } function populateCities(cities, userCity) { @@ -217,8 +215,6 @@ citySelect.val(userCity); citySelect.attr("disabled", null); - - context.JK.dropdown(citySelect); } /****************** MAIN PORTION OF SCREEN *****************/ @@ -249,8 +245,6 @@ selectLocation = new context.JK.SelectLocation(getCountryElement(), getRegionElement(), getCityElement(), app); selectLocation.load(userDetail.country, userDetail.state, userDetail.city) }); - - context.JK.dropdown($('select'), $screen); } function navToAccount() { @@ -436,7 +430,6 @@ else { cityElement.children().remove(); cityElement.append($(nilOptionStr).text(nilOptionText)); - context.JK.dropdown(cityElement); } } diff --git a/web/app/assets/javascripts/accounts_profile_experience.js b/web/app/assets/javascripts/accounts_profile_experience.js index 1f032cb5d..c058edb1f 100644 --- a/web/app/assets/javascripts/accounts_profile_experience.js +++ b/web/app/assets/javascripts/accounts_profile_experience.js @@ -64,8 +64,6 @@ $screen.find('select[name=skill_level]').val(userDetail.skill_level); $screen.find('select[name=concert_count]').val(userDetail.concert_count); $screen.find('select[name=studio_session_count]').val(userDetail.studio_session_count); - - context.JK.dropdown($('select', $screen)); } function isUserInstrument(instrument, userInstruments) { @@ -159,8 +157,6 @@ var userDetail = userDetailResponse[0]; populateAccountProfile(userDetail, instrumentsResponse[0]); }); - - context.JK.dropdown($('select'), $screen); } function navigateTo(targetLocation) { diff --git a/web/app/assets/javascripts/helpBubbleHelper.js b/web/app/assets/javascripts/helpBubbleHelper.js index b348ed629..f9419b189 100644 --- a/web/app/assets/javascripts/helpBubbleHelper.js +++ b/web/app/assets/javascripts/helpBubbleHelper.js @@ -28,8 +28,7 @@ } function bigHelpOptions(options) { - return {positions: options.positions, offsetParent: options.offsetParent, - width:options.width, + var defaults = { spikeGirth: 15, spikeLength: 20, fill: 'white', @@ -40,8 +39,27 @@ fontSize: '20px', backgroundColor:'transparent', color:'#ed3618'}} + + return $.extend({}, defaults, options) } + function bigHelpDarkOptions(options) { + var defaults = { + spikeGirth: 15, + spikeLength: 20, + fill: '#242323', + cornerRadius:8, + strokeWidth: 2, + cssStyles: { + fontWeight:'bold', + fontSize: '20px', + backgroundColor:'transparent', + color:'#ed3618'}} + + return $.extend({}, defaults, options) + } + + function clearJamTrackGuideTimeout() { if(jamTrackGuideTimeout) { clearTimeout(jamTrackGuideTimeout); @@ -135,4 +153,8 @@ return context.JK.prodBubble($element, 'jamtrack-web-play', {}, bigHelpOptions({positions:['bottom'], offsetParent: $offsetParent})) } + helpBubble.teacherMusicianProfile = function($element, $offsetParent) { + return context.JK.prodBubble($element, 'teacher-musician-profile', {}, bigHelpDarkOptions({spikeGirth:0, spikeLength: 0, duration:60000, offsetParent:$offsetParent, width:385, positions:['top', 'right', 'bottom']})) + } + })(window, jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee b/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee index a722c935b..e96a1c6d1 100644 --- a/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee @@ -339,41 +339,32 @@ UserStore = context.UserStore SEARCH TEACHERS ` - learnMoreLink = `LEARN MORE` - learnMoreAboutJamClass = `

- JamClass is the best way to take music lessons, offering significant advantages over both traditional - face-to-face lessons - and online skype lessons. -

` - signupTestDrive = `
-

sign up for testdrive

-

- There are two awesome, painless ways to get started with JamClass. -

+ if @state.user?['can_buy_test_drive?'] + rightContent = `
-

- Sign up for TestDrive and take 4 full 30-minute lessons - one each from 4 different instructors - for just - $49.99. - You wouldn't marry the first person you date, right? Find the best teacher for you. It's the most important - factor in the success for your lessons! -

+

+ JamClass is the best way to teach or take online music lessons. Learn more about teaching or taking lessons. +

-

- Or take one JamClass lesson free. It's on us! We're confident you'll take more. -

+

TestDrive offers 3 unbeatable options for students to try JamClass online lessons, and to find the best teacher:

+
    +
  1. Take 4 full 30-minute lessons from 4 different teachers. Just $49.99. Great for making sure you click with the best teacher for you.
  2. +
  3. Take 2 full 30-minute lessons from 2 different teachers. Just $29.99. Two lessons for the price of one or try two different teachers.
  4. +
  5. Take 1 full 30-minute lesson for $9.99. Great value for the online experience if you're sure which teacher you want.
  6. +
-

- Sign up for TestDrive using the button below, or to take one free lesson, search our teachers, and click the - Book Free Lesson on your favorite. -

+
+ SIGN UP FOR TESTDRIVE +
+
` + else + rightContent = `
+

Read our JamClass user guide for students to learn how to get the most out of your online lessons! +

+

If you have any problems, please email us at support@jamkazam.com. We're here to help make your lessons a great experience.

+
` -
- SIGN UP FOR TESTDRIVE - or - SEARCH TEACHERS -
-
` else searchTeachers = `

stripe status

@@ -381,12 +372,6 @@ UserStore = context.UserStore
` - learnMoreLink = `LEARN MORE` - learnMoreAboutJamClass = `

- JamClass is the best way to teach music lessons, offering significant advantages over both traditional - face-to-face lessons - and online skype lessons. -

` if this.state.user? teacherProfileUri = "/client#/profile/teacher/#{this.state.user.id}" pct = Math.round(this.state.user.teacher?.profile_pct) @@ -400,10 +385,16 @@ UserStore = context.UserStore pctCompleteMsg = `

Your teacher profile is {pct}% complete. The following sections of your profile are missing information. Click any of these links to view and add missing information:

` missingLinks = @constructMissingLinks(this.state.user) - signupTestDrive = `
+ rightContent = `
{pctCompleteMsg} {missingLinks} VIEW TEACHER PROFILE +

+ Read our JamClass user guide for teachers to learn how to get the most out of the JamClass technology and marketplace. +

+

+ If you have any problems, please email us support@jamkazam.com. We're here to help you build your lesson business. +

` classes = [] @@ -458,26 +449,7 @@ UserStore = context.UserStore {searchTeachers}
-
-

learn about jamclass

- - {learnMoreAboutJamClass} - -
- {learnMoreLink} -
-
- {signupTestDrive} -
-

get ready for your first lesson

- -

Be sure to set up and test the JamKazam app in an online music session a few days before - your first lesson! We're happy to help, and we'll even get in a session with you to make sure everything - is working properly. Ping us at support@jamkazam.com anytime, and - read our - JamClass user guide to learn how to use all the lesson features. -

-
+ {rightContent}

` diff --git a/web/app/assets/javascripts/react-components/TeacherProfile.js.jsx.coffee b/web/app/assets/javascripts/react-components/TeacherProfile.js.jsx.coffee index 45861f89f..533b3539a 100644 --- a/web/app/assets/javascripts/react-components/TeacherProfile.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/TeacherProfile.js.jsx.coffee @@ -65,6 +65,8 @@ proficiencyDescriptionMap = { componentDidUpdate:() -> @starbox() + context.JK.popExternalLinks(@root) + starbox:() -> $ratings = @root.find('.ratings-box') $ratings.each((i, value) => @@ -176,15 +178,15 @@ proficiencyDescriptionMap = { embedId = @getYoutubeId(videoUrl) embedUrl = "//www.youtube.com/embed/#{embedId}" + video = ` + + ` + return `

Intro Video

-
-
-