Sha256: cd2147323ac7454285e9414b0b2b29fb1f30691787d02d9f0017ce01d4ba330e

Contents?: true

Size: 829 Bytes

Versions: 46

Compression:

Stored size: 829 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|
        begin
          UserMailer.custom_email(email: mail, subject: subject, message: message).deliver_now
        rescue => e
          logger.error '============= send_mails Mailer ============='
          logger.error e
        end
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
my_forum-0.0.1.beta25 app/controllers/my_forum/admin/mail_controller.rb
my_forum-0.0.1.beta24 app/controllers/my_forum/admin/mail_controller.rb
my_forum-0.0.1.beta23 app/controllers/my_forum/admin/mail_controller.rb
my_forum-0.0.1.beta22 app/controllers/my_forum/admin/mail_controller.rb
my_forum-0.0.1.beta21 app/controllers/my_forum/admin/mail_controller.rb
my_forum-0.0.1.beta20 app/controllers/my_forum/admin/mail_controller.rb