mailer_controller.rb 1.09 KB
Newer Older
gitlabhq's avatar
gitlabhq committed
1
class Admin::MailerController < ApplicationController
gitlabhq's avatar
gitlabhq committed
2
  layout "admin"
gitlabhq's avatar
gitlabhq committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16
  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
Nihad Abbasov's avatar
Nihad Abbasov committed
17
      render :file => 'notify/note_commit_email', :layout => 'notify'
gitlabhq's avatar
gitlabhq committed
18 19
    when "Issue" then
      @issue = Issue.first
Nihad Abbasov's avatar
Nihad Abbasov committed
20
      render :file => 'notify/note_issue_email', :layout => 'notify'
gitlabhq's avatar
gitlabhq committed
21
    else
Nihad Abbasov's avatar
Nihad Abbasov committed
22
      render :file => 'notify/note_wall_email', :layout => 'notify'
gitlabhq's avatar
gitlabhq committed
23
    end
Nihad Abbasov's avatar
Nihad Abbasov committed
24
  rescue
gitlabhq's avatar
gitlabhq committed
25 26 27 28 29 30 31
    render :text => "Preview not avaialble"
  end

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

Nihad Abbasov's avatar
Nihad Abbasov committed
32
    render :file => 'notify/new_user_email', :layout => 'notify'
Nihad Abbasov's avatar
Nihad Abbasov committed
33
  rescue
gitlabhq's avatar
gitlabhq committed
34 35 36 37 38 39 40
    render :text => "Preview not avaialble"
  end

  def preview_issue_new
    @issue = Issue.first
    @user = @issue.assignee
    @project = @issue.project
Nihad Abbasov's avatar
Nihad Abbasov committed
41
    render :file => 'notify/new_issue_email', :layout => 'notify'
Nihad Abbasov's avatar
Nihad Abbasov committed
42
  rescue
gitlabhq's avatar
gitlabhq committed
43 44 45
    render :text => "Preview not avaialble"
  end
end