Sha256: 7446d3fc7ba8c2b4adc2ead00dc4b0403b413f63623ac55989f4cb52556914df

Contents?: true

Size: 999 Bytes

Versions: 5

Compression:

Stored size: 999 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 :js => "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

5 entries across 5 versions & 1 rubygems

Version Path
mail_engine-0.1.15 app/controllers/mail_engine/mail_template_files_controller.rb
mail_engine-0.1.14 app/controllers/mail_engine/mail_template_files_controller.rb
mail_engine-0.1.13 app/controllers/mail_engine/mail_template_files_controller.rb
mail_engine-0.1.12 app/controllers/mail_engine/mail_template_files_controller.rb
mail_engine-0.1.11 app/controllers/mail_engine/mail_template_files_controller.rb