summaryrefslogtreecommitdiff
path: root/app/controllers/admin/mailer_controller.rb
blob: 05ad267fad50aca9c7eebd3773eb80d6094e698d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class Admin::MailerController < ApplicationController
  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
      render :file => 'notify/note_commit_email.html.haml', :layout => 'notify'
    when "Issue" then
      @issue = Issue.first
      render :file => 'notify/note_issue_email.html.haml', :layout => 'notify'
    else
      render :file => 'notify/note_wall_email.html.haml', :layout => 'notify'
    end
  rescue 
    render :text => "Preview not avaialble"
  end

  def preview_user_new
    @user = User.first
    @password = "DHasJKDHAS!"

    render :file => 'notify/new_user_email.html.haml', :layout => 'notify'
  rescue 
    render :text => "Preview not avaialble"
  end

  def preview_issue_new
    @issue = Issue.first
    @user = @issue.assignee
    @project = @issue.project
    render :file => 'notify/new_issue_email.html.haml', :layout => 'notify'
  rescue 
    render :text => "Preview not avaialble"
  end
end