Sha256: 8e57bdcf0aa0abda3430699c2cbdb0a09b5840374dc17bed99f7256eb3a12208

Contents?: true

Size: 1001 Bytes

Versions: 2

Compression:

Stored size: 1001 Bytes

Contents

class MailEngine::MailTemplateFilesController < MailEngine::ApplicationController
  layout "mail_engine/simple"
  before_filter :find_model

  def index
  end

  def edit
  end

  def show
  end

  def new
    @mail_template_file = @mail_template.mail_template_files.new
  end

  def create
    @mail_template_file = @mail_template.mail_template_files.build(params[:mail_engine_mail_template_file])
    if @mail_template_file.save
      close_modal_and_refresh
    else
      render :new
    end
  end

  def update
    if @mail_template_file.update_attributes(params[:mail_engine_mail_template_file])
      close_modal_and_refresh
    else
      render :edit
    end
  end

  def destroy
    @mail_template_file.destroy
    render :text => "window.location.reload()"
  end

  private

  def find_model
    @mail_template = MailTemplate.find(params[:mail_template_id]) if params[:mail_template_id].present?
    @mail_template_file = MailTemplateFile.find(params[:id]) if params[:id].present?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mail_engine-0.1.10 app/controllers/mail_engine/mail_template_files_controller.rb
mail_engine-0.1.9 app/controllers/mail_engine/mail_template_files_controller.rb