fix activeadmin filter

This commit is contained in:
Seth Call 2018-01-23 20:59:45 -06:00
parent 70781c85f3
commit 778e89e01f
10 changed files with 115 additions and 4 deletions

View File

@ -66,6 +66,38 @@ module JamRuby
end
end
def teacher_no_comm_other(lesson_booking)
user = lesson_booking.teacher
@student = lesson_booking.student
@lesson_booking = lesson_booking
@suppress_user_has_account_footer = true
sendgrid_recipients([user.email])
sendgrid_substitute('@USERID', [user.id])
sendgrid_unique_args :type => "teacher_no_comm_other"
mail(:to => user.email, :subject => "JamKazam is attempting to contact " + @student.name) do |format|
format.text
format.html
end
end
def student_no_comm_other(lesson_booking, really_late)
user = lesson_booking.student
@teacher = lesson_booking.teacher
@lesson_booking = lesson_booking
@really_late = really_late
@suppress_user_has_account_footer = true
sendgrid_recipients([user.email])
sendgrid_substitute('@USERID', [user.id])
sendgrid_unique_args :type => "student_no_comm_other"
mail(:to => user.email, :subject => "JamKazam is attempting to contact " + @teacher.name) do |format|
format.text
format.html
end
end
def amazon_welcome_message(user)
@user = user
@subject = "Your 2 free music lessons"
@ -206,6 +238,7 @@ module JamRuby
end
end
def updated_email(user)
@user = user

View File

@ -0,0 +1,19 @@
<% provide(:title, 'We are attempting to contact ' + @teacher.name) %>
<% if @really_late %>
<p>
We know the teacher <%= @teacher.name %> has not responded to your last message still.<br/><br/>At this point, it might make sense to cancel your lesson request and try a new teacher. Click the button below to view a web page with your lesson request. You may cancel the request from that page.<br/><br/>
</p>
<% else %>
<p>
We know the teacher <%= @teacher.name %> has not responded to your last message in a while, and we are reaching out to them on your behalf.<br /><br/> Please sit tight!<br/><br/>
<p>
<% end %>
<a href="<%= @lesson_booking.web_url %>" style="margin: 8px 0 0 0;background-color: #ed3618;border: solid 1px #F27861;padding: 3px 10px;font-size: 12px;font-weight: 300;cursor: pointer;color: #FC9;text-decoration: none;line-height: 12px;text-align: center;">VIEW LESSON REQUEST</a>

View File

@ -0,0 +1,16 @@
<% provide(:title, 'We are attempting to contact ' + @teacher.name) %>
<% if @really_late %>
We know the teacher <%= @teacher.name %> has not responded to your last message still. At this point, it might make sense to cancel your lesson request and try a new teacher.
<% else %>
We know the teacher <%= @teacher.name %> has not responded to your last message in a while, and we are reaching out to them on your behalf. Please sit tight!
<% end %>
To see this lesson request, click here: <%= @lesson_booking.web_url %>

View File

@ -1,3 +1,3 @@
<%= @sender.name %> has requested a lesson.
To see this lesson request, click here: <%= @lesson_booking.home_url %>
To see this lesson request, click here: <%= @lesson_booking.web_url %>

View File

@ -0,0 +1,8 @@
<% provide(:title, 'We are attempting to contact ' + @student.name) %>
<p>
We know the student <%= @student.name %> has not responded to your last message in a while, and we are reaching out to them on your behalf.<br /><br/> Please sit tight!<br/><br/>
<p>
<a href="<%= @lesson_booking.web_url %>" style="margin: 8px 0 0 0;background-color: #ed3618;border: solid 1px #F27861;padding: 3px 10px;font-size: 12px;font-weight: 300;cursor: pointer;color: #FC9;text-decoration: none;line-height: 12px;text-align: center;">VIEW LESSON REQUEST</a>

View File

@ -0,0 +1,8 @@
We know the student <%= @student.name %> has not responded to your last message in a while, and we are reaching out to them on your behalf.
Please sit tight!
To see this lesson request, click here: <%= @lesson_booking.web_url %>

View File

@ -26,7 +26,7 @@ session, in which we will make sure your audio and video gear are working proper
sure you feel comfortable with the key features you will be using in sessions with students.
3. Learn About JamClass Features
Click this link for a set of help articles specifically for teachers</a> to learn how to respond to student lesson
Click this link for a set of help articles specifically for teachers to learn how to respond to student lesson
requests, how to join your lessons when they are scheduled to begin, how to get paid, and more (https://jamkazam.desk.com/customer/en/portal/topics/926076-jamclass-online-music-lessons---for-teachers/articles).
You can also use this link for a set of help articles that explain how to use the key features available to you in online sessions to
effectively teach students (https://jamkazam.desk.com/customer/en/portal/topics/673198-key-features-to-use-in-online-sessions/articles).

View File

@ -136,8 +136,7 @@ module JamRuby
# notifications
has_many :notifications, :class_name => "JamRuby::Notification", :foreign_key => "target_user_id"
has_many :inverse_notifications, :through => :notifications, :class_name => "JamRuby::User"
# chats
has_many :chats, :class_name => "JamRuby::ChatMessage", :foreign_key => "user_id"

View File

@ -186,6 +186,30 @@ describe "RenderMailers", :slow => true do
claim = FactoryGirl.create(:claimed_recording, user: user)
UserMailer.lesson_attachment(user, teacher, lesson, claim).deliver_now
end
it "teacher_no_comm_other" do
@filename = "teacher_no_comm_other"
lesson = testdrive_lesson(user, teacher)
UserMailer.deliveries.clear
UserMailer.teacher_no_comm_other(lesson.lesson_booking).deliver_now
end
it "student_no_comm_other (late)" do
@filename = "student_no_comm_other"
lesson = testdrive_lesson(user, teacher)
UserMailer.deliveries.clear
UserMailer.student_no_comm_other(lesson.lesson_booking, false).deliver_now
end
it "student_no_comm_other (really late)" do
@filename = "student_no_comm_other_late"
lesson = testdrive_lesson(user, teacher)
UserMailer.deliveries.clear
UserMailer.student_no_comm_other(lesson.lesson_booking, true).deliver_now
end
end
end

View File

@ -24,6 +24,10 @@ describe "TeacherLessonEmails" do
mail.to.should eql [teacher.email]
end
def student_always
mail.to.should eql [user.email]
end
def school_and_teacher
if @noSchool
mail.to.should eql [teacher.email]