Sha256: 1fa5c193f7e9107fbc5f8716ede2bd487673654a61fb46a09b5790a12932d2bc
Contents?: true
Size: 1.61 KB
Versions: 4
Compression:
Stored size: 1.61 KB
Contents
class MailEngine::MailSchedulesController < MailEngine::ApplicationController before_filter :find_model def index @mail_schedules = MailSchedule.order("created_at desc").page(params[:page]).per(20) end def show end def destroy @mail_schedule.destroy redirect_to mail_schedules_path end def create @mail_schedule = MailSchedule.new(params[:mail_engine_mail_schedule].merge(:payload => params[:mail_engine_mail_schedule][:payload].try(:join, ','))) if @mail_schedule.save redirect_to mail_schedule_path(@mail_schedule), :notice => 'Mail schedule was successfully created.' else render "new" end end def new if MailTemplate.for_marketing.count == 0 flash[:notice] = "Add Marketing mail template first." redirect_to :action => :index end @mail_schedule = MailSchedule.new end def update if @mail_schedule.update_attributes(params[:mail_engine_mail_schedule].merge(:payload => params[:mail_engine_mail_schedule][:payload].join(','))) redirect_to mail_schedule_path(@mail_schedule), :notice => 'Mail schedule was successfully updated.' else render "new" end end def edit end def send_test_mail @mail_schedule.send_test_mail_to!(params[:recipient], params[:sample_user_id]) render :text => %Q{alert("Test Mail sent to #{params[:recipient]}"); $('#recipient').val('');} rescue => e render :text => %Q{alert("Test Mail failed to send to #{params[:recipient]}, due to #{e.to_s}"); $('#recipient').val('');} end private def find_model @mail_schedule = MailSchedule.find(params[:id]) if params[:id] end end
Version data entries
4 entries across 4 versions & 1 rubygems