Sha256: 195b3b8662450ed6640a46ccb862a9f169cf5a23292d0113be5c1f491639d71a

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

require_dependency "my_forum/application_controller"

module MyForum
  class Admin::MailController < ApplicationController
    before_filter :verify_admin

    layout 'layouts/my_forum/admin_application'

    def index
      if request.post?
        send_mails(params[:emails], params[:subject], params[:message]) unless params[:emails].blank?
        redirect_to admin_mail_list_path
      else
        @users = User.all.map{ |u| [u.login, u.email]}
      end
    end

    private

    def send_mails(email_list, subject, message)
      email_list.each do |mail|
        UserMailer.custom_email(email: mail, subject: subject, message: message).deliver_now
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
my_forum-0.0.1.beta18 app/controllers/my_forum/admin/mail_controller.rb