Sha256: 8053cf4c7e3b5925fffbb1602b9b32e7906808fa876ffac2b40580239929809f

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

class Fe::Admin::EmailTemplatesController < ApplicationController
  before_filter :check_valid_user
  layout 'fe/fe.admin'
  
  def index 
    @email_templates = Fe::EmailTemplate.order('name')
  
    respond_to do |format|
      format.html
    end
  end
  
  def new 
    @email_template = Fe::EmailTemplate.new
  
    respond_to do |format|
      format.html
    end
  end
  
  def edit
    @email_template = Fe::EmailTemplate.find(params[:id])
    
    respond_to do |format|
      format.html
    end
  end
  
  def create
    @email_template = Fe::EmailTemplate.new(email_template_params)
    
    respond_to do |format|
      if @email_template.save
        format.html { redirect_to admin_email_templates_path }
      else
        format.html { render :action => :new }
      end
    end
  end
  
  def update 
    @email_template = Fe::EmailTemplate.find(params[:id])
    
    respond_to do |format|
      if @email_template.update_attributes(email_template_params)
        format.html { redirect_to fe_admin_email_templates_path }
      else
        format.html { render :action => "edit" }
      end
    end
  end
  
  def destroy
    @email_template = Fe::EmailTemplate.find(params[:id])
    @email_template.destroy

    respond_to do |format|
      format.html { redirect_to email_templates_path }
    end
  end

  protected
  
    def email_template_params
      params.require(:email_template).permit(:name, :subject, :content)
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fe-0.0.4 app/controllers/fe/admin/email_templates_controller.rb