From b781902f7d942f969fe508bf8979476fa47476c9 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 9 Sep 2016 09:53:38 -0500 Subject: [PATCH] many more school fixes --- .../AccountRetailerScreen.js.jsx.coffee | 2 +- .../AccountSchoolScreen.js.jsx.coffee | 6 ++- .../InviteSchoolUserDialog.js.jsx.coffee | 5 ++- .../SchoolTeacherLandingPage.js.jsx.coffee | 28 +++++++++---- .../react-components/AccountSchoolScreen.scss | 10 +++++ web/app/controllers/api_schools_controller.rb | 2 +- web/app/controllers/landings_controller.rb | 1 + web/app/views/api_schools/show.rabl | 42 +++++++++++++++---- 8 files changed, 73 insertions(+), 23 deletions(-) diff --git a/web/app/assets/javascripts/react-components/AccountRetailerScreen.js.jsx.coffee b/web/app/assets/javascripts/react-components/AccountRetailerScreen.js.jsx.coffee index 887134368..d59f88b4b 100644 --- a/web/app/assets/javascripts/react-components/AccountRetailerScreen.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/AccountRetailerScreen.js.jsx.coffee @@ -141,7 +141,7 @@ profileUtils = context.JK.ProfileUtils @app.ajaxError(jqXHR, null, null) inviteTeacher: () -> - @app.layout.showDialog('invite-retailer-user', {d1: true}) + @app.layout.showDialog('invite-school-user', {d1: true}) resendInvitation: (id, e) -> e.preventDefault() diff --git a/web/app/assets/javascripts/react-components/AccountSchoolScreen.js.jsx.coffee b/web/app/assets/javascripts/react-components/AccountSchoolScreen.js.jsx.coffee index 838d5d8c7..c3a891370 100644 --- a/web/app/assets/javascripts/react-components/AccountSchoolScreen.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/AccountSchoolScreen.js.jsx.coffee @@ -210,13 +210,15 @@ profileUtils = context.JK.ProfileUtils if !photo_url? photo_url = '/assets/shared/avatar_generic.png' + mailto = "mailto:#{user.email}" + `
- {user.name}
- {user.email} + {user.name} + {user.email}
remove from school diff --git a/web/app/assets/javascripts/react-components/InviteSchoolUserDialog.js.jsx.coffee b/web/app/assets/javascripts/react-components/InviteSchoolUserDialog.js.jsx.coffee index 50eaf7610..5ef30a370 100644 --- a/web/app/assets/javascripts/react-components/InviteSchoolUserDialog.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/InviteSchoolUserDialog.js.jsx.coffee @@ -53,9 +53,10 @@ SchoolStore = context.SchoolStore }).done((response) => @createDone(response)).fail((jqXHR) => @createFail(jqXHR)) createDone: (response) -> - context.SchoolActions.addInvitation(response) + console.log("invitation added", response) + context.SchoolActions.addInvitation(this.state.teacher, response) context.JK.Banner.showNotice("invitation sent", "Your invitation has been sent!") - @app.layout.closeDialog('invite-retailer-user') + @app.layout.closeDialog('invite-school-user') createFail: (jqXHR) -> handled = false diff --git a/web/app/assets/javascripts/react-components/landing/SchoolTeacherLandingPage.js.jsx.coffee b/web/app/assets/javascripts/react-components/landing/SchoolTeacherLandingPage.js.jsx.coffee index f22f63463..b6e56bc6f 100644 --- a/web/app/assets/javascripts/react-components/landing/SchoolTeacherLandingPage.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/landing/SchoolTeacherLandingPage.js.jsx.coffee @@ -40,7 +40,7 @@ rest = context.JK.Rest()
- +
@@ -60,6 +60,22 @@ rest = context.JK.Rest()
` + if this.props.school.education + explain = `

Please register here if you are a private music lesson teacher affiliated with the {this.props.school.name} + music program, and if you are interested in teaching online music lessons using the JamKazam service. When you + have registered, someone from JamKazam will contact you to answer any questions you have about our online lesson + service. We'll help you get set up and ready to go, and we'll get into an online session with you to make sure + everything is working properly.

` + else + explain = `

Please register here if you are currently a teacher with {this.props.school.name}, and if you plan + to teach + online music lessons for students of {this.props.school.name} using the JamKazam service. When you have + registered, we + will + email you instructions to set up your online teacher profile, and we'll schedule a brief online training session + to make sure + you are comfortable using the service and ready to go with students in online lessons.

` + `
@@ -75,13 +91,7 @@ rest = context.JK.Rest()
-

- Please register here if you are currently a teacher with {this.props.school.name}, and if you plan to teach - online music lessons for students of {this.props.school.name} using the JamKazam service. When you have registered, we - will - email you instructions to set up your online teacher profile, and we'll schedule a brief online training session to make sure - you are comfortable using the service and ready to go with students in online lessons. -

+ {explain}
{register} @@ -111,7 +121,7 @@ rest = context.JK.Rest() else @createUser() - @setState({processing:true}) + @setState({processing: true}) createUser: () -> $form = $('.school-signup-form') diff --git a/web/app/assets/stylesheets/client/react-components/AccountSchoolScreen.scss b/web/app/assets/stylesheets/client/react-components/AccountSchoolScreen.scss index 3e69ca14c..37b51ee81 100644 --- a/web/app/assets/stylesheets/client/react-components/AccountSchoolScreen.scss +++ b/web/app/assets/stylesheets/client/react-components/AccountSchoolScreen.scss @@ -247,6 +247,16 @@ line-height:32px; vertical-align: middle; display: inline-block; + + } + + .just-name { + display:block; + } + .just-email { + position: relative; + top: -14px; + font-size:12px; } .user-actions { diff --git a/web/app/controllers/api_schools_controller.rb b/web/app/controllers/api_schools_controller.rb index ace715949..770d4be8b 100644 --- a/web/app/controllers/api_schools_controller.rb +++ b/web/app/controllers/api_schools_controller.rb @@ -7,7 +7,7 @@ class ApiSchoolsController < ApiController respond_to :json def show - + @owner_viewing = @school.owner == current_user end def update diff --git a/web/app/controllers/landings_controller.rb b/web/app/controllers/landings_controller.rb index d02161a44..c116b321f 100644 --- a/web/app/controllers/landings_controller.rb +++ b/web/app/controllers/landings_controller.rb @@ -400,6 +400,7 @@ class LandingsController < ApplicationController @description = "View the profile and pick a teacher right for you from " + @school.name @preview = !params[:preview].nil? + @show_approved_only = true schoolRabl = Rabl::Renderer.json(@school, 'api_schools/show') @page_data = {school: @school, preview: @preview, rabl: schoolRabl} diff --git a/web/app/views/api_schools/show.rabl b/web/app/views/api_schools/show.rabl index 56c04f92a..026079333 100644 --- a/web/app/views/api_schools/show.rabl +++ b/web/app/views/api_schools/show.rabl @@ -8,16 +8,42 @@ end child :students => :students do attributes :id, :name, :first_name, :last_name, :photo_url + + if @owner_viewing + attributes :email + end end -child :approved_teachers => :teachers do |teacher| - attributes :id +if @show_approved_only + child :approved_teachers => :teachers do |teacher| + attributes :id - child :instruments do |teacher| - attributes :id, :description - end + child :instruments do |teacher| + attributes :id, :description + end - child :user => :user do - attributes :id, :name, :first_name, :last_name, :photo_url, :teacher_profile_url, :resolved_photo_url + child :user => :user do + attributes :id, :name, :first_name, :last_name, :photo_url, :teacher_profile_url, :resolved_photo_url + + if @owner_viewing + attributes :email + end + end end -end \ No newline at end of file +else +child :teachers => :teachers do |teacher| + attributes :id + + child :instruments do |teacher| + attributes :id, :description + end + + child :user => :user do + attributes :id, :name, :first_name, :last_name, :photo_url, :teacher_profile_url, :resolved_photo_url + + if @owner_viewing + attributes :email + end + end + end +end