Add ActionMailer implementation for plug-in

pull/6827/head
Hagen Schink 12 years ago
parent 26b4b89b0e
commit 4ed3294a2f
  1. 2
      app/controllers/meeting_contents_controller.rb
  2. 15
      app/mailers/meeting_mailer.rb
  3. 11
      app/views/meeting_mailer/content_for_review.html.erb
  4. 9
      app/views/meeting_mailer/content_for_review.text.erb

@ -53,7 +53,7 @@ class MeetingContentsController < ApplicationController
def notify
unless @content.new_record?
Mailer.deliver_content_for_review(@content, @content_type)
MeetingMailer.content_for_review(@user, @content, @content_type).deliver
flash[:notice] = l(:notice_successful_notification)
end
redirect_back_or_default :controller => 'meetings', :action => 'show', :id => @meeting

@ -0,0 +1,15 @@
class MeetingMailer < UserMailer
def content_for_review(user, content, content_type)
@meeting = content.meeting
@meeting_url = meeting_url @meeting
@project_url = project_url @meeting.project
@content_type = content_type
open_project_headers 'Project' => @meeting.project.identifier,
'Meeting-Id' => @meeting.id
subject = "[#{@meeting.project.name}] #{I18n.t(:"label_meeting_#{content_type}")}: #{@meeting.title}"
mail :to => user.mail, :cc => @meeting.watcher_recipients, :subject => subject
end
end

@ -0,0 +1,11 @@
<h1><%= link_to(@meeting.project.name, @project_url) %>: <%= link_to(@meeting.title, @meeting_url) %></h1>
<em><%= @meeting.author %></em>
<ul>
<li><%=t :label_meeting_date_time %>: <%= format_date @meeting.start_date %> <%= format_time @meeting.start_time, false %>-<%= format_time @meeting.end_time, false %></li>
<li><%=t :field_location %>: <%= @meeting.location %></li>
<li><%=t :field_participants_invited %>: <%= @meeting.participants.invited.sort.join("; ") %></li>
<li><%=t :field_participants_attended %>: <%= @meeting.participants.attended.sort.join("; ") %></li>
</ul>
<p><%=raw t(:"text_review_#{@content_type}", :author => h(User.current), :link => link_to(@meeting.title, @meeting_url)) %></p>

@ -0,0 +1,9 @@
<%= @meeting.project.name %>: <%= @meeting.title %> (<%= @meeting_url %>)
<%= @meeting.author %>
<%=t :label_meeting_date_time %>: <%= format_date @meeting.start_date %> <%= format_time @meeting.start_time, false %>-<%= format_time @meeting.end_time, false %>
<%=t :field_location %>: <%= @meeting.location %>
<%=t :field_participants_invited %>: <%= @meeting.participants.invited.sort.join("; ") %>
<%=t :field_participants_attended %>: <%= @meeting.participants.attended.sort.join("; ") %>
<%=t(:"text_review_#{@content_type}", :author => User.current, :link => t(:"text_#{@content_type}_for_meeting", :meeting => @meeting.title) + " (#{@meeting_url})") %>
Loading…
Cancel
Save