forked from doubtfire-lms/doubtfire-api
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class TeacherResponseMailer < ApplicationMailer | ||
def add_general | ||
@doubtfire_host = Doubtfire::Application.config.institution[:host] | ||
@doubtfire_product_name = Doubtfire::Application.config.institution[:product_name] | ||
@unsubscribe_url = "#{@doubtfire_host}/#/home?notifications" | ||
end | ||
|
||
def recieved_notification(project, task) | ||
return nil if project.nil? | ||
|
||
add_general | ||
|
||
@student = project.student | ||
@project = project | ||
@convenor = project.main_convenor_user | ||
|
||
email_with_name = %("#{@student.name}" <#{@student.email}>) | ||
convenor_email = %("#{@convenor.name}" <#{@convenor.email}>) | ||
subject = "#{project.unit.name} #{task}: You have recieved comments." | ||
mail(to: email_with_name, from: convenor_email, subject: subject) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
app/views/teacher_response_mailer/recieved_notification.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style type="text/css"> | ||
body { | ||
font-family: "Lucida Grande", "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
color: #333; | ||
font-size: 14px; | ||
width: 500px; | ||
margin: 100px auto 0px auto; | ||
font-size: 0.9em; | ||
} | ||
main { | ||
background-image: url('https://<%= @doubtfire_host %>/assets/images/logo.svg'); | ||
background-size: 3.5em; | ||
background-repeat: no-repeat; | ||
background-position: 30px 45px; | ||
padding: 30px 40px; | ||
padding-left: 100px; | ||
border: solid 1px #aaa; | ||
border-radius: 7px; | ||
line-height: 200%; | ||
text-align: justify; | ||
} | ||
footer { | ||
text-align: right; | ||
margin-top: 10px; | ||
color: #aaa; | ||
font-size: 0.7em; | ||
} | ||
a, a:visited { | ||
color: #6a97d2; | ||
text-decoration: none; | ||
} | ||
a:hover { | ||
text-decoration: underline; | ||
} | ||
ul { | ||
list-style: none; | ||
} | ||
h1 { | ||
font-size: 1.1em; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<main> | ||
<h1> <%= @doubtfire_product_name %> Notification </h1> | ||
<p>Hi <%= @student.first_name %>,</p> | ||
<p> | ||
I have checked your tasks and provided some feedback. Login and check the status <%= @hasComments ? 'and comments' : ''%> of the following tasks: | ||
<ul> | ||
<% @tasks.each do |task| %> | ||
<li> | ||
<strong><%= task.task_definition.abbreviation %> - </strong> | ||
<a href="https://<%= @doubtfire_host %>/#/projects/<%=@project.id%>/dashboard/<%=task.task_definition.abbreviation%>"> | ||
<%=task.task_definition.name%> | ||
</a> | ||
<%= task.is_last_comment_by?(@tutor) ? ' with comments' : ''%> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</p> | ||
<p> | ||
Cheers, <br /> | ||
The <%= @doubtfire_product_name %> Team on behalf of <%= @tutor.name %> | ||
</p> | ||
</main> | ||
<footer> | ||
<a href="<%= @unsubscribe_url %>">Unsubscribe</a> | Generated with <%= @doubtfire_product_name %> | ||
</footer> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
app/views/teacher_response_mailer/recieved_notification.text.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Hi <%= @student.first_name %>, | ||
|
||
I have checked your tasks and provided some feedback. Login and check the status<%= @has_comments ? ' and comments' : ''%> of the following tasks: | ||
|
||
<% @tasks.each do |task| %> | ||
* <%= task.task_definition.abbreviation %> - <%=task.task_definition.name%> <%= task.is_last_comment_by?(@tutor) ? ' - with comments' : ''%> | ||
<% end %> | ||
|
||
Cheers, | ||
The <%= @doubtfire_product_name %> Team on behalf of <%= @tutor.name %> | ||
|
||
--- | ||
|
||
Visit <%= @unsubscribe_url%> to unsubscribe from these notifications. | ||
|
||
Generated with <%= @doubtfire_product_name %> |