many more school fixes

This commit is contained in:
Seth Call 2016-09-09 09:53:38 -05:00
parent bca4356e43
commit b781902f7d
8 changed files with 73 additions and 23 deletions

View File

@ -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()

View File

@ -210,13 +210,15 @@ profileUtils = context.JK.ProfileUtils
if !photo_url?
photo_url = '/assets/shared/avatar_generic.png'
mailto = "mailto:#{user.email}"
`<div className="school-user">
<div className="avatar">
<img src={photo_url}/>
</div>
<div className="usersname">
{user.name}<br/>
{user.email}
<span className="just-name">{user.name}</span>
<span className="just-email"><a href={mailto}>{user.email}</a></span>
</div>
<div className="user-actions">
<a onClick={this.removeFromSchool.bind(this, user.id, isTeacher)}>remove from school</a>

View File

@ -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

View File

@ -40,7 +40,7 @@ rest = context.JK.Rest()
</div>
<form className="school-signup-form">
<div className="field">
<label>Email: </label><input type="text" defaultValue={this.props.defaultEmail} name="email"/>
<label>Email: </label><input type="text" defaultValue={this.props.defaultEmail} name="email"/>
</div>
<div className="field">
<label>Password: </label><input type="password" name="password"/>
@ -60,6 +60,22 @@ rest = context.JK.Rest()
</div>`
if this.props.school.education
explain = `<p>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.</p>`
else
explain = `<p> 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.</p>`
`<div className="container">
<div className="header-area">
<div className="header-content">
@ -75,13 +91,7 @@ rest = context.JK.Rest()
</div>
<div className="explain">
<p>
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.
</p>
{explain}
</div>
{register}
@ -111,7 +121,7 @@ rest = context.JK.Rest()
else
@createUser()
@setState({processing:true})
@setState({processing: true})
createUser: () ->
$form = $('.school-signup-form')

View File

@ -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 {

View File

@ -7,7 +7,7 @@ class ApiSchoolsController < ApiController
respond_to :json
def show
@owner_viewing = @school.owner == current_user
end
def update

View File

@ -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}

View File

@ -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
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