2011-10-08 23:36:38 +02:00
|
|
|
class Admin::MailerController < ApplicationController
|
2011-11-02 16:21:17 +01:00
|
|
|
layout "admin"
|
2011-10-08 23:36:38 +02:00
|
|
|
before_filter :authenticate_user!
|
|
|
|
before_filter :authenticate_admin!
|
|
|
|
|
|
|
|
def preview
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def preview_note
|
|
|
|
@note = Note.first
|
|
|
|
@user = @note.author
|
|
|
|
@project = @note.project
|
|
|
|
case params[:type]
|
|
|
|
when "Commit" then
|
|
|
|
@commit = @project.commit
|
2012-05-29 16:16:28 +02:00
|
|
|
render :file => 'notify/note_commit_email', :layout => 'notify'
|
2011-10-08 23:36:38 +02:00
|
|
|
when "Issue" then
|
|
|
|
@issue = Issue.first
|
2012-05-29 16:16:28 +02:00
|
|
|
render :file => 'notify/note_issue_email', :layout => 'notify'
|
2011-10-08 23:36:38 +02:00
|
|
|
else
|
2012-05-29 16:16:28 +02:00
|
|
|
render :file => 'notify/note_wall_email', :layout => 'notify'
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
2011-10-26 15:46:25 +02:00
|
|
|
rescue
|
2012-06-26 18:17:23 +02:00
|
|
|
render :text => "Preview not available"
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def preview_user_new
|
|
|
|
@user = User.first
|
|
|
|
@password = "DHasJKDHAS!"
|
|
|
|
|
2012-05-29 16:16:28 +02:00
|
|
|
render :file => 'notify/new_user_email', :layout => 'notify'
|
2011-10-26 15:46:25 +02:00
|
|
|
rescue
|
2012-06-26 18:17:23 +02:00
|
|
|
render :text => "Preview not available"
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def preview_issue_new
|
|
|
|
@issue = Issue.first
|
|
|
|
@user = @issue.assignee
|
|
|
|
@project = @issue.project
|
2012-05-29 16:16:28 +02:00
|
|
|
render :file => 'notify/new_issue_email', :layout => 'notify'
|
2011-10-26 15:46:25 +02:00
|
|
|
rescue
|
2012-06-26 18:17:23 +02:00
|
|
|
render :text => "Preview not available"
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
end
|